title: Swagger failing with Failed to load API definition (yet another thread)
body: <p>I tried to add swagger to an existing api and after failing alot, i decided to create a new solution, create a new asp.net core 2.2 api and added swagger as per </p>
  
  <p><a href="https://docs.microsoft.com/en-us/aspnet/core/tutorials/getting-started-with-swashbuckle?view=aspnetcore-2.2&amp;tabs=visual-studio" rel="nofollow noreferrer">https://docs.microsoft.com/en-us/aspnet/core/tutorials/getting-started-with-swashbuckle?view=aspnetcore-2.2&amp;tabs=visual-studio</a></p>
  
  <p>The other posts regarding this issue seem all to indicate a situation where there are multiple httpverbs or none, which is not the case with the default valuescontroller. It gives me the error</p>
  
  <blockquote>
    <p>Failed to load API Definition. </p>
    
    <p>Fetch error, Service unavailable /swagger/v1/swagger.json</p>
  </blockquote>
  
  <p>The actual json file  at api/swagger/v1/swagger.json actually renders correctly</p>
  
  <p>My startup class is</p>
  
  <pre><code>public class Startup
  {
      public Startup(IConfiguration configuration)
      {
          Configuration = configuration;
      }
  
      public IConfiguration Configuration { get; }
  
      public void ConfigureServices(IServiceCollection services)
      {
          services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
          services.AddSwaggerGen(c =&gt;{
              c.SwaggerDoc("v1", new Info { Title = "My API", Version = "v1" });
          });
      }
  
      public void Configure(IApplicationBuilder app, IHostingEnvironment env)
      {
          if (env.IsDevelopment())
          {
              app.UseDeveloperExceptionPage();
          }
  
          app.UseSwagger();
          app.UseSwaggerUI(c =&gt;
          {
              c.SwaggerEndpoint("/swagger/v1/swagger.json", "My API V1");
          });
          app.UseMvc();
      }
  }
  </code></pre>
  
  <p>Im using Swachbuckle.AspNetCore v 4.01.</p>