skip to Main Content

How to read environment variables in .NET 6? – Asp.net

in my .NET Core 3.1 WebApi project I'm reading environment variable as the very first thing and loading appsettings.json according to it: public static IHostBuilder CreateHostBuilder(string[] args) { string environment = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT"); ... } But I didn't find out how…

VIEW QUESTION

Minimal API and XML formatters – Asp.net

Trying out minimal APIs in .NET 6 and can't make it work with XML content type. If I use standard controllers, using .AddXmlSerializerFormatters() extension does the job: builder.Services.AddControllers().AddXmlSerializerFormatters(); But when I switch from controller to .MapPost(..), I start getting 415…

VIEW QUESTION
Back To Top
Search