Error Description: according netcore2.X configuration, after re-configuration swagger, / swagger / index.html open. . .
Solution: Configure method in Startup.cs file
// allow cross-domain app.UseCors ( " the any " ); // Enable middleware services generated Swagger as JSON endpoint app.UseSwagger (); // Enable middleware services to swagger-ui, designated Swagger JSON endpoint app. UseSwaggerUI (C => { c.SwaggerEndpoint ( " /swagger/v1/swagger.json " , " My Vl the API " ); c.RoutePrefix = String .Empty; });
The standard yellow background of this removed it. Or to a particular route, to replace the default Swagger, such as
c.RoutePrefix = "doc";
The swagger of access address becomes "/doc/index.html"
Reference Address: https://docs.microsoft.com/zh-cn/aspnet/core/tutorials/getting-started-with-swashbuckle?view=aspnetcore-3.1&tabs=visual-studio
To apply the root (HTTP: // provide Swagger UI, the property set to an empty string RoutePrefix <port> /: localhost):
It might be set to the default address conflict and procedures, but do not know why 2.X before the problem does not exist. . .