{"id":6911,"date":"2019-04-06T20:32:20","date_gmt":"2019-04-06T20:32:20","guid":{"rendered":"http:\/\/putridparrot.com\/blog\/?p=6911"},"modified":"2019-04-06T20:32:20","modified_gmt":"2019-04-06T20:32:20","slug":"a-net-service-registered-with-eureka","status":"publish","type":"post","link":"https:\/\/putridparrot.com\/blog\/a-net-service-registered-with-eureka\/","title":{"rendered":"A .NET service registered with Eureka"},"content":{"rendered":"<p>To create a .NET service which is registered with Eureka we&#8217;ll use the Steeltoe libraries&#8230;<\/p>\n<p>Create an ASP.NET Core Web Application and select WebApi. Add the Steeltoe.Discovery.Client NuGet package, now in the Startup.cs within ConfigureServices add the following<\/p>\n<pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\r\nservices.AddDiscoveryClient(Configuration);\r\n<\/pre>\n<p>and within the Configure method add <\/p>\n<pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\r\napp.UseDiscoveryClient();\r\n<\/pre>\n<p>We&#8217;re not going to create any other code to implement a service, but we will need some configuration added to the appsettings.json file, so add the following<\/p>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">\r\n&quot;spring&quot;: {\r\n    &quot;application&quot;: {\r\n      &quot;name&quot;: &quot;eureka-test-service&quot;\r\n    }\r\n  },\r\n  &quot;eureka&quot;: {\r\n    &quot;client&quot;: {\r\n      &quot;serviceUrl&quot;: &quot;http:\/\/localhost:8761\/eureka\/&quot;,\r\n      &quot;shouldRegisterWithEureka&quot;: true,\r\n      &quot;shouldFetchRegistry&quot;: false\r\n    },\r\n    &quot;instance&quot;: {\r\n      &quot;hostname&quot;: &quot;localhost&quot;,\r\n      &quot;port&quot;: 5000\r\n    }\r\n  }\r\n<\/pre>\n<p>The application name is what&#8217;s going to be displayed within Eureka and visible via http:\/\/localhost:8761\/eureka\/apps (obviously replacing the host name and ip with your Eureka server&#8217;s).<\/p>\n","protected":false},"excerpt":{"rendered":"<p>To create a .NET service which is registered with Eureka we&#8217;ll use the Steeltoe libraries&#8230; Create an ASP.NET Core Web Application and select WebApi. Add the Steeltoe.Discovery.Client NuGet package, now in the Startup.cs within ConfigureServices add the following services.AddDiscoveryClient(Configuration); and within the Configure method add app.UseDiscoveryClient(); We&#8217;re not going to create any other code to [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[3,240],"tags":[],"class_list":["post-6911","post","type-post","status-publish","format-standard","hentry","category-c","category-eureka"],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/posts\/6911","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/comments?post=6911"}],"version-history":[{"count":2,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/posts\/6911\/revisions"}],"predecessor-version":[{"id":6913,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/posts\/6911\/revisions\/6913"}],"wp:attachment":[{"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/media?parent=6911"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/categories?post=6911"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/tags?post=6911"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}