简体   繁体   中英

Custom route for Swashbuckle

I am trying to register a custom route for swashbuckle. However I can't figure this one out.

What I need to do is to add an extension to the current route.

So for example: Instead of swagger/ui I need to set it to swagger.aspx/ui.. This is since my application will be hosted on a server where I have no access and its running IIS6.

Any ideas?

I have tried:

RouteTable.Routes.Remove(RouteTable.Routes["swagger_docs"]);
RouteTable.Routes.Remove(RouteTable.Routes["swagger_ui"]);
config.EnableSwagger("docs.aspx/{apiVersion}/swagger", c => c.SingleApiVersion("v1", "A title for your API")).EnableSwaggerUi("swagger.aspx/{*assetPath}");

But with no success... :(

In theory that should work! there is even a similar config in the UnitTests: https://github.com/domaindrivendev/Swashbuckle/blob/e0053e1864defa3c4f73ca2a960eb876e257cc9e/Swashbuckle.Tests/Owin/MultiSwaggerOwinStartup.cs

But there could be a bug lurking in there...


Your best bet will be to create a custom swashbuckle that suit your needs.

You will need to change the DefaultRouteTemplate: https://github.com/domaindrivendev/Swashbuckle/blob/e0053e1864defa3c4f73ca2a960eb876e257cc9e/Swashbuckle.Core/Application/HttpConfigurationExtensions.cs#L15

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM