Abd@SDET@ML
API Swagger URL is not loading at all through .NET aspire 9.0
magically i was able to fix the actual issue without adding above code
this below method is called in program.cs, and i have commented builder.ConfigureKestrel(appConfig);
there was a warning in console logs of aspire for the same which i ignored initially
public static async Task ExecuteAsync(this WebApplicationBuilder builder,
CancellationToken cancellationToken = default)
{
var appConfig = builder
.Configuration
.GetSection("ApplicationConfiguration")
.Get<ApplicationConfiguration>();
builder.Configuration.AddJsonFile("secret.json", optional: true);
builder.UserSerilog(appConfig);
//builder.ConfigureKestrel(appConfig);
builder.ConfigureCors(appConfig);
var webHost = builder.WebHost;
webHost.ConfigureServices();
var app = builder.Build();
app.UseExceptionHandler();
app.UseMiddleware<CorrelationIdMiddleware>();
app.UsePathBase(appConfig.ApiInfo.BasePath);
app.UseHttpsRedirection();
app.UseCorsIfEnabled(appConfig);
app.UseAuthentication();
app.UseAuthorization();
app.UseSerilogRequestLogging();
app.UseSwagger(appConfig);
app.UseSwaggerUI(appConfig);
app.MapControllers();
await app.RunAsync(cancellationToken);
}
27 replies
API Swagger URL is not loading at all through .NET aspire 9.0
Hi, yes got the launchsettings.json file and here is the code
{
"$schema": "https://json.schemastore.org/launchsettings.json",
"profiles": {
"O.WP.API": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
/"launchUrl": "asset/windfarms",/
"launchUrl": "swagger",
"applicationUrl": "http://localhost:8050/pit/act",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}
27 replies