title: Swagger/Swashbuckle error - Unable to render this definition
body: <p>.Netcore 2.2
  Swashbuckle 4.0.1</p>
  
  <p>Swagger UI works on localhost but after deploying to Azure ASE to site that is managed by Application Gateway, the swagger will not load. (confirmed swagger.json is generated). Error is.....</p>
  
  <p>Unable to render this definition
  The provided definition does not specify a valid version field.</p>
  
  <p>Please indicate a valid Swagger or OpenAPI version field. Supported version fields are swagger: "2.0" and those that match  openapi: 3.0.n (for example, openapi: 3.0.0).</p>
  
  <p>I have gone through other similar posts and tried others suggestions, with no resolution. Here is the applicable code from startup.</p>
  
  <pre><code>            app.UseStaticFiles();
  
          if (env.IsDevelopment())
          {
              app.UseSwagger(c =&gt;
              {
                  c.RouteTemplate = "swagger/{documentName}/swagger.json";
  
              });
          }
          else
          {
  
              app.UseSwagger(c =&gt;
              {
                  c.RouteTemplate = "swagger/{documentName}/swagger.json";
  
                  c.PreSerializeFilters.Add((doc, request) =&gt;
                  {
                      var root = request.Host.Value;
                      doc.Host = root;
  
                  });
              });
          }
          // Enable middleware to serve swagger-ui (HTML, JS, CSS, etc.), 
          // specifying the Swagger JSON endpoint.
          app.UseSwaggerUI(c =&gt;
          {
              c.SwaggerEndpoint("/swagger/v1/swagger.json", "TestSwagger Api V1");
              c.RoutePrefix = string.Empty;
          });
  
  
          app.UseMvc();
  
  
  /* from ConfigureServices */
  
    services.AddSwaggerGen(c =&gt;
          {
              c.SwaggerDoc("v1", new Info { Title = "My API", Version = "v1" });
          });  
  </code></pre>