I have created a WebApi Project using this article.
Things are working fine. But now my client want to view the documentation using Swagger. I tried to do configurat
If I'm reading this correctly, you are calling the Register method before you are calling Configuration in Startup? If this is the case, I think you are needlessly complicating things. This is what I typically do:
public class Startup
{
public void Configuration(IAppBuilder app)
{
var config = new HttpConfiguration();
config.MapHttpAttributeRoutes();
// Any additional configuration: filters, services, etc.
config.EnableSwagger(x => x.SingleApiVersion("v1", "Application Name")).EnableSwaggerUi();
app.UseWebApi(config)
}
}
If you are enabling Swagger on the global configuration, and starting Web Api on a new HttpConfiguration instance, then that is most likely your problem.
Hope that helps.
I had tons of issues with Owin + Swashbuckle integration. I managed to solve it and created an open source repo to be used as a template for anyone who needs it!
Please check: ASPSwaggerOwinTemplate