1

Recently we migrated .net3.1 to .net6.0 with minmal hosting model. Steeltoe configuration is not loading after migration, but the same is working in .netcore 3.1. code: builder.ConfigureAppConfiguration((hostContext, configApp) => { configApp.AddConfigServer(); })

app is deployed in azure Error we are getting as

Application: w3wp.exe

CoreCLR Version: 6.0.322.12309 .NET Version: 6.0.3 Description: The process was terminated due to an unhandled exception. Exception Info: Steeltoe.Extensions.Configuration.ConfigServer.ConfigServerException: Could not locate PropertySource, fail fast property is set, failing ---> System.Net.Http.HttpRequestException: An attempt was made to access a socket in a way forbidden by its access permissions. (localhost:8888) ---> System.Net.Sockets.SocketException (10013): An attempt was made to access a socket in a way forbidden by its access permissions. at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken) at

ren
  • 21
  • 3
  • What version of Steeltoe? Also note that Steeltoe doesn't have access to the environment name with the version of code you have listed here. – Tim Mar 10 '22 at 12:31
  • Steeltoe Version 3.1.3 – ren Mar 11 '22 at 13:40

1 Answers1

0

Check your settings for the config server address and the order your config providers are added. The message you're seeing is a failure to connect to localhost on port 8888. Unless you're running the config server on the same machine as your app in Azure, there's a misconfiguration.

I can't tell which builder you're configuring, but Steeltoe 3.1.3 in a .NET 6 minimal API project connects fine to a config server running on localhost with this example: .csproj:

<Project Sdk="Microsoft.NET.Sdk.Web">

  <PropertyGroup>
    <TargetFramework>net6.0</TargetFramework>
    <Nullable>enable</Nullable>
    <ImplicitUsings>enable</ImplicitUsings>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Steeltoe.Extensions.Configuration.ConfigServerCore" Version="3.1.3" />
  </ItemGroup>
</Project>

appsettings.json:

{
  "Spring": { "Cloud": { "Config": { "FailFast": true } } }
}

program.cs:

using Steeltoe.Extensions.Configuration.ConfigServer;

var builder = WebApplication.CreateBuilder(args);
builder.Configuration.AddConfigServer();
builder.Services.AddRazorPages();

var app = builder.Build();
if (!app.Environment.IsDevelopment())
{
    app.UseExceptionHandler("/Error");
    app.UseHsts();
}

app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseRouting();
app.UseAuthorization();
app.MapRazorPages();
app.Run();
Tim
  • 2,587
  • 13
  • 18