'.net framework setup swagger UI to point to index.html instead of swagger/ui/index
In all our .net core projects that use swagger, to access it we simply go to URL/index.html. However, for some reason the .net framework swagger is pointing to URL/swagger/ui/index. How can I change it so it's consistent with my other projects. Here's my code:
public class WebApi
{
public void Configuration(IAppBuilder app)
{
var config = new HttpConfiguration();
config.EnableCors(new EnableCorsAttribute("*", "*", "*"));
config.MapHttpAttributeRoutes();
config.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "api/{controller}/{id}",
defaults: new { id = RouteParameter.Optional }
);
config.EnableSwagger(c =>
{
c.SingleApiVersion("v1", "stuff");
})
.EnableSwaggerUi(c =>
{
c.DocumentTitle("Swagger UI");
});
app.UseWebApi(config);
app.UseCors(CorsOptions.AllowAll);
}
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|