IIS site within virtual directory Swagger UI end point

前端 未结 5 381
我在风中等你
我在风中等你 2020-12-19 00:35

Swagger UI end point is not same as dev in staging ( excluding domain names)

IIS Configuration

public void Configure(IApplicationBuilder app         


        
5条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-19 01:14

    The problem is more relevant to swagger than Environment variable. Swagger does support the virtual directory which then the configuration should look like below. Note that virtual directory doesn't affect the UI End point.

    app.UseSwagger(c =>
                {
                    //Change the path of the end point , should also update UI middle ware for this change                
                    c.RouteTemplate = "api-docs/{documentName}/swagger.json";
                });
     app.UseSwaggerUI(c =>
                {
                    //Include virtual directory if site is configured so
                    c.RoutePrefix = "api-docs";
                    c.SwaggerEndpoint("v1/swagger.json", "Api v1");
                });
    

提交回复
热议问题