title: Getting Fetch errorNot Found /swagger/v1/swagger.json in swashbuckle Asp.netcore
body: <p>I have a basic asp.net core 3.1 app. I installed SwashBuckle.ASPNetCore nuget package.</p>
  <p>here is my startup.cs. When I run this as a separate application, swagger is working fine. But Once I deploy this to IIS, I am getting 404 not found. Do I need to add a Path somewhere?
  I looked almost everything but things are not working for me.</p>
  <p><a href="https://i.stack.imgur.com/Rabun.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Rabun.png" alt="enter image description here" /></a></p>
  <pre><code> public void ConfigureServices(IServiceCollection services)
      {
          
          JwtSecurityTokenHandler.DefaultMapInboundClaims = false;
  
          services.AddProtectedWebApi(Configuration);
  
          // Additional configuration
          services.Configure&lt;JwtBearerOptions&gt;(JwtBearerDefaults.AuthenticationScheme, options =&gt;
          {
              options.TokenValidationParameters.RoleClaimType = &quot;roles&quot;;
          });
  
        
          // Register the Swagger generator, defining 1 or more Swagger documents
          services.AddSwaggerGen(c =&gt;
          {
              c.SwaggerDoc(&quot;v1&quot;, new OpenApiInfo { Title = &quot;Channel.API&quot;, Version = &quot;v1&quot; });
  
              /*var security = new Dictionary&lt;string, IEnumerable&lt;string&gt;&gt;
              {
                  {&quot;Bearer&quot;, new string[] { }},
              };
              c.AddSecurityDefinition(&quot;bearerAuth&quot;, new OpenApiSecurityScheme()
              {
                  Description =
                      &quot;JWT Authorization header using the Bearer scheme. Example: \&quot;Authorization: Bearer {token}\&quot;&quot;,
                  Name = &quot;Authorization&quot;,
                  Type = SecuritySchemeType.ApiKey,
                  In = ParameterLocation.Header,
                  Scheme = &quot;Bearer&quot;
              });
              c.AddSecurityRequirement(new OpenApiSecurityRequirement{
                  {
                      new OpenApiSecurityScheme{
                          Reference = new OpenApiReference{
                              Id = &quot;Bearer&quot;, //The name of the previously defined security scheme.
                              Type = ReferenceType.SecurityScheme
                          }
                      },new List&lt;string&gt;()
                  }
              });*/
          });
  
          services.AddApplicationInsightsTelemetry();
  
      }
  
   
      public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
      {
          // Enable middleware to serve generated Swagger as a JSON endpoint.
          //app.UseSwagger();
  
          // Enable middleware to serve swagger-ui (HTML, JS, CSS, etc.),
          // specifying the Swagger JSON endpoint.
         
  
          if (env.IsDevelopment())
          {
              app.UseDeveloperExceptionPage();
             app.UseSwagger();
              app.UseSwaggerUI(c =&gt;
              {
                  c.SwaggerEndpoint(&quot;/swagger/v1/swagger.json&quot;, &quot;My API V1&quot;);
              });
          }
          else
          {
              app.UseSwaggerUI(c =&gt;
              {
                  c.SwaggerEndpoint(&quot;v1/swagger.json&quot;, &quot;My API V1&quot;);
              });
          }
          app.UseHsts();
          app.UseHttpsRedirection();
  
          app.UseRouting();
  
          app.UseAuthentication();
          app.UseAuthorization();
  
          app.UseEndpoints(endpoints =&gt;
          {
              endpoints.MapDefaultControllerRoute();
              endpoints.MapControllers();
          });
  
          app.UseElmah();
      }
  </code></pre>
  <p><strong>Update</strong></p>
  <p>Resolved this by adding ..</p>
  <p>c.SwaggerEndpoint(&quot;../swagger/v1/swagger.json&quot;, &quot;My API V1&quot;);</p>