How to use Swagger as Welcome Page of IAppBuilder in WebAPI

后端 未结 12 1398
遥遥无期
遥遥无期 2020-12-24 05:59

I try to use Swagger with Microsoft WebAPI 2.

For the moment, I\'ve the following call in a method.

appBuilder
   .ConfigureOAuth()
   .UseWebApi(con         


        
12条回答
  •  生来不讨喜
    2020-12-24 06:43

    If you've come here looking for the asp.net core 2 answer you can acheive the same by setting the RoutePrefix of swagger to the apps root

    app.UseSwaggerUI(c =>
                {
                    c.SwaggerEndpoint("/swagger/v1/swagger.json", "My service");
                    c.RoutePrefix = string.Empty;  // Set Swagger UI at apps root
                });
    

    How to redirect root to swagger in Asp.Net Core 2.x?

提交回复
热议问题