You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to resolve 500 error which comes up when we load swagger documentation. When I look into Swagger.json I don't find any stack trace but I see a one liner though. Here, I want to know the exact stack trace and the error.
What code or approach do you have so far?
` services.AddSwaggerGen(options =>
{
options.SwaggerDoc("v1", new Microsoft.OpenApi.Models.OpenApiInfo
{
Version = "v1",
Title = " Api",
Description = "An ASP.NET Core Web API.",
Contact = new Microsoft.OpenApi.Models.OpenApiContact
{
Name = " ",
Email = "
}
});
// XML documentation setup
var xmlFile = $"{Assembly.GetExecutingAssembly().GetName().Name}.xml";
options.IncludeXmlComments(Path.Combine(AppContext.BaseDirectory, xmlFile));
options.ResolveConflictingActions(apiDescriptions => apiDescriptions.First());
Check your server error logs. The response is failing for some reason, and then your error handling appears to return a type name in the response, which swagger UI then doesn't know what to do with.
Check your server error logs. The response is failing for some reason, and then your error handling appears to return a type name in the response, which swagger UI then doesn't know what to do with.
Thank you for your response. I'm running the code locally and I checked EventViewer and I don't see anything.
What are you wanting to achieve?
I'm trying to resolve 500 error which comes up when we load swagger documentation. When I look into Swagger.json I don't find any stack trace but I see a one liner though. Here, I want to know the exact stack trace and the error.
What code or approach do you have so far?
` services.AddSwaggerGen(options =>
{
options.SwaggerDoc("v1", new Microsoft.OpenApi.Models.OpenApiInfo
{
Version = "v1",
Title = " Api",
Description = "An ASP.NET Core Web API.",
Contact = new Microsoft.OpenApi.Models.OpenApiContact
{
Name = " ",
Email = "
}
});
// XML documentation setup
var xmlFile = $"{Assembly.GetExecutingAssembly().GetName().Name}.xml";
options.IncludeXmlComments(Path.Combine(AppContext.BaseDirectory, xmlFile));
options.ResolveConflictingActions(apiDescriptions => apiDescriptions.First());
});
// Swagger Annotations
services.AddSwaggerGen(action => action.EnableAnnotations(enableAnnotationsForInheritance: true, enableAnnotationsForPolymorphism: true));
app.UseDeveloperExceptionPage();
app.UseMiddleware();
app.ConfigureExceptionHandler();
app.UseSwagger(options =>
{
options.SerializeAsV2 = true;
});
app.UseSwaggerUI(options =>
{
options.SwaggerEndpoint("/swagger/v1/swagger.json", "v1");
});
app.UseHttpsRedirection();
app.UseRouting();
app.UseLoggingMiddleware();
app.UseAuthorization();
app.UseEndpoints(endpoints =>
{
endpoints.MapControllers();
});
app.UseWarmup(_services);
`
Additional context
No response
The text was updated successfully, but these errors were encountered: