2

I'm using swagger but when I host my webapi in IIS, swagger is stripping the website name off. The website is a virtual directory/application in IIS called LotsWebApi.

When I hit this url: http://localhost/LotsWebApi/swagger/ui/index.html I get "Can't read swagger JSON from http://localhost/swagger/v1/swagger.json"

You can see that it is stripping off the 'LotsWebApi'.

My register swagger code looks like this...

    private static void RegisterSwagger(IServiceCollection services)
    {
        services.AddSwaggerGen();
        services.ConfigureSwaggerGen(options =>
        {
            options.SingleApiVersion(new Info
            {
                Version = "v1",
                Title = "LOTS Web API",
                Description = "API for LOTS Web"                                       
            });
        });

        services.AddSwaggerGen();
    }
FeeFiFoFum
  • 1,719
  • 1
  • 11
  • 18

0 Answers0