I begin with Swashbuckle, i make a Web API in .NET Core with Swashbuckle. I need to deploy my API in a sub-application of an IIS site
IIS infrastructure
IIS Site (site)
- myApi (subApplication)
I would like the access to swagger UI to be done via this url :
http://ip:80/myApi/swagger I would like the access to the methods to be done by this url :
http://ip:80/myApi/api/[controller]/methode ConfigureServices(IServiceCollection services)
services.AddSwaggerGen(c => { c.SwaggerDoc("v1", new Swashbuckle.AspNetCore.Swagger.Info { Title = "My REST API", Version = "v1" }); }); Configure(IApplicationBuilder app..)
if (env.IsEnvironment("ProdIT")) { app.UseSwagger(c => { c.PreSerializeFilters.Add((swaggerDoc, httpReq) => swaggerDoc.BasePath = "/myApi/"); c.RouteTemplate = "myApi/api-docs/{documentName}/swagger.json"; }); app.UseSwaggerUI(c => { c.RoutePrefix = "myApi/swagger"; c.SwaggerEndpoint("/myApi/api-docs/v1/swagger.json", "MY REST API V1");}); Route Controller
[Route("api/[controller]")] Could you tell me what's wrong with my code?
Thanks in advance