From 123e17f252525a294b05c2cb0b954eaef1be3771 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 29 Jan 2026 17:38:15 +0000 Subject: [PATCH 1/3] Initial plan From 797a10e345f4e5a60faa3fba4ab82a1ea7acf118 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 29 Jan 2026 17:42:06 +0000 Subject: [PATCH 2/3] Add Urls configuration and helpful comments for service discovery Co-authored-by: TimHess <3947063+TimHess@users.noreply.github.com> --- src/Content/NetCoreTool.Template.WebApi/CSharp/Program.cs | 6 ++++++ .../CSharp/appsettings.Development.json | 7 ++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/Content/NetCoreTool.Template.WebApi/CSharp/Program.cs b/src/Content/NetCoreTool.Template.WebApi/CSharp/Program.cs index 1814e41..543b624 100644 --- a/src/Content/NetCoreTool.Template.WebApi/CSharp/Program.cs +++ b/src/Content/NetCoreTool.Template.WebApi/CSharp/Program.cs @@ -165,6 +165,8 @@ builder.Configuration.AddPlaceholderResolver(); #endif #if (HasAnyNonAzureHostingInSteeltoeV3) +// Configures the application to listen on the port(s) provided by the cloud platform. +// For local development, configure URLs in appsettings.Development.json instead. builder.UseCloudHosting(); #endif #if (HostingCloudFoundryOption) @@ -221,12 +223,16 @@ builder.Services.ConfigureCloudFoundryOptions(builder.Configuration); #endif #if (HasAnyDiscoveryInSteeltoeV3) +// Registers the application with a service discovery provider (e.g., Eureka, Consul). +// For local development, ensure service URLs are configured in appsettings.Development.json. builder.Services.AddDiscoveryClient(builder.Configuration); #else #if (HasDiscoveryConsulInSteeltoeV44) +// Registers the application with Consul for service discovery. builder.Services.AddConsulDiscoveryClient(); #endif #if (HasDiscoveryEurekaInSteeltoeV4) +// Registers the application with Eureka for service discovery. builder.Services.AddEurekaDiscoveryClient(); #endif #endif diff --git a/src/Content/NetCoreTool.Template.WebApi/CSharp/appsettings.Development.json b/src/Content/NetCoreTool.Template.WebApi/CSharp/appsettings.Development.json index f0e6b7d..9e97b22 100644 --- a/src/Content/NetCoreTool.Template.WebApi/CSharp/appsettings.Development.json +++ b/src/Content/NetCoreTool.Template.WebApi/CSharp/appsettings.Development.json @@ -7,5 +7,10 @@ "Default": "Information", "Microsoft.AspNetCore": "Warning" } - } + }, + //#if (HasAnyDiscovery) + // When running locally, specify the URLs so that service discovery can properly register this application. + // These URLs should match the ports defined in launchSettings.json. + "Urls": "https://localhost:5001;http://localhost:5000" + //#endif } From 207ff56a30b05a3e8745d99049b405afadf0fe1a Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 29 Jan 2026 17:51:06 +0000 Subject: [PATCH 3/3] Remove Urls config per Steeltoe v4 dynamic port detection; keep helpful comments Co-authored-by: TimHess <3947063+TimHess@users.noreply.github.com> --- .../NetCoreTool.Template.WebApi/CSharp/Program.cs | 10 +++++----- .../CSharp/appsettings.Development.json | 7 +------ 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/src/Content/NetCoreTool.Template.WebApi/CSharp/Program.cs b/src/Content/NetCoreTool.Template.WebApi/CSharp/Program.cs index 543b624..c12cba2 100644 --- a/src/Content/NetCoreTool.Template.WebApi/CSharp/Program.cs +++ b/src/Content/NetCoreTool.Template.WebApi/CSharp/Program.cs @@ -166,7 +166,6 @@ #endif #if (HasAnyNonAzureHostingInSteeltoeV3) // Configures the application to listen on the port(s) provided by the cloud platform. -// For local development, configure URLs in appsettings.Development.json instead. builder.UseCloudHosting(); #endif #if (HostingCloudFoundryOption) @@ -223,16 +222,17 @@ builder.Services.ConfigureCloudFoundryOptions(builder.Configuration); #endif #if (HasAnyDiscoveryInSteeltoeV3) -// Registers the application with a service discovery provider (e.g., Eureka, Consul). -// For local development, ensure service URLs are configured in appsettings.Development.json. +// Registers this application with a service discovery provider (e.g., Eureka, Consul). builder.Services.AddDiscoveryClient(builder.Configuration); #else #if (HasDiscoveryConsulInSteeltoeV44) -// Registers the application with Consul for service discovery. +// Registers this application with Consul for service discovery. +// Port registration is automatically detected from the server's listening addresses. builder.Services.AddConsulDiscoveryClient(); #endif #if (HasDiscoveryEurekaInSteeltoeV4) -// Registers the application with Eureka for service discovery. +// Registers this application with Eureka for service discovery. +// Port registration is automatically detected from the server's listening addresses. builder.Services.AddEurekaDiscoveryClient(); #endif #endif diff --git a/src/Content/NetCoreTool.Template.WebApi/CSharp/appsettings.Development.json b/src/Content/NetCoreTool.Template.WebApi/CSharp/appsettings.Development.json index 9e97b22..f0e6b7d 100644 --- a/src/Content/NetCoreTool.Template.WebApi/CSharp/appsettings.Development.json +++ b/src/Content/NetCoreTool.Template.WebApi/CSharp/appsettings.Development.json @@ -7,10 +7,5 @@ "Default": "Information", "Microsoft.AspNetCore": "Warning" } - }, - //#if (HasAnyDiscovery) - // When running locally, specify the URLs so that service discovery can properly register this application. - // These URLs should match the ports defined in launchSettings.json. - "Urls": "https://localhost:5001;http://localhost:5000" - //#endif + } }