Swashbuckle.AspNetCore
Swashbuckle.AspNetCore copied to clipboard
Failed to load API definition. Fetch error. Not Found /swagger/v1/swagger.json
Thanks for contributing to Swashbuckle.AspNetCore! As per the contributing guidelines, please adhere to the following rules of thumb before submitting your issue:
- If it's not a bug report, feature request or PR, don't submit it here. Post to Stackoverflow instead.
- If your issue is specifically a UI concern, don't submit it here. Post to the swagger-ui repo.
- For bug reports, specify the version you're using and provide clear repro steps.
Swashbuckle Version 6.2.3.
Steps:
- In Visual Studio debug the project.
- Navigate to localhost:12345/swagger
- Observe "LOADING" for a few minutes
- After a few minutes observe: Failed to load API definition. Fetch Error. Not Found /swagger/v1/swagger.json
startup.cs
services.AddSwaggerGen(c =>
{
c.SwaggerDoc("v1", new OpenApiInfo
{
Version = "v1",
Title = "...",
Description = "...",
Contact = new OpenApiContact
{
Name = "...",
Email = "[email protected]",
Url = new Uri("https://...")
}
});
var xmlFile = $"{Assembly.GetExecutingAssembly().GetName().Name}.xml";
var xmlPath = Path.Combine(AppContext.BaseDirectory, xmlFile);
c.IncludeXmlComments(xmlPath);
});
...
app.UseDeveloperExceptionPage();
app.UseSwagger();
app.UseSwaggerUI(c =>
{
c.SwaggerEndpoint("/swagger/v1/swagger.json", "...");
});