Swagger not working in IIS

Sachin Kulkarni 1 Reputation point
2021-05-19T06:38:11.383+00:00

Hi,

Below is the code. I have hosted in IIS but I am getting 404 error. I have used double dot.
Configure

    services.AddSwaggerGen(c =>
            {
                 c.SwaggerDoc("v1", new OpenApiInfo { Title = "TestWebApi", Version = "v1" });

                //
                c.AddSecurityDefinition("Bearer", new OpenApiSecurityScheme
                {
                    In = ParameterLocation.Header,
                    Description = "Please insert JWT with Bearer into field",
                    Name = "Authorization",
                    Type = SecuritySchemeType.ApiKey
                });
                c.AddSecurityRequirement(new OpenApiSecurityRequirement {
   {
     new OpenApiSecurityScheme
     {
       Reference = new OpenApiReference
       {
         Type = ReferenceType.SecurityScheme,
         Id = "Bearer"
       }
      },
      new string[] { }
    }
            });
        });

ConfigureServices

 app.UseSwaggerUI(c => c.SwaggerEndpoint("../swagger/v1/swagger.json", "TestWebApi v1") 

                );
ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,161 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Sachin Kulkarni 1 Reputation point
    2021-05-25T11:44:08.34+00:00

    I cannot see any vs folder

    0 comments No comments

  2. Adriano Leal 0 Reputation points
    2023-07-27T10:14:27.51+00:00

    Hi, have you found a solution for this issue Sachin Kulkarni?

    I'm facing exactly the same issue, tried many alternatives found in forums, but nothing has worked for me.

    0 comments No comments