title: Swagger Page is 404 Not Found in MVC net-core
body: <p>I have a brand new .NET-Core Web API project that I want to use API versioning and swagger.</p>
  
  <p>When I try to view the swagger page I get a 404. However, the default ValuesController that comes with the template works.</p>
  
  <p>Here is my setup:</p>
  
  <p>Startup.cs</p>
  
  <pre><code>    public void ConfigureServices(IServiceCollection services)
      {
          services.AddMvc();
  
          // Add API Versioning
          services.AddApiVersioning(
              options =&gt;
              {
                  options.DefaultApiVersion = new ApiVersion(1, 0);
                  options.AssumeDefaultVersionWhenUnspecified = true;
                  options.ReportApiVersions = true;
              });
  
          // Add Swagger
          string pathToDoc = "RegistriesApi.xml";
          services.AddSwaggerGen(options =&gt;
          {
              options.SwaggerDoc("v1",
                  new Info
                  {
                      Title = "Registries API",
                      Version = "v1",
                      Description = "A simple api to interact with AMA registries information",
                      TermsOfService = "None"
                  });
  
              string filePath = Path.Combine(PlatformServices.Default.Application.ApplicationBasePath, pathToDoc);
              options.IncludeXmlComments(filePath);
              options.DescribeAllEnumsAsStrings();
          });
      }
      ...
      public void Configure(IApplicationBuilder app, IHostingEnvironment env)
      {
          // Url Path Rewriter
          RewriteOptions rewriteOptions = new RewriteOptions();
          if (!env.IsDevelopment())
          {
              rewriteOptions.AddRedirectToHttps();
          }
          else
          {
              app.UseDeveloperExceptionPage();
          }
          app.UseRewriter(rewriteOptions);
  
          // Use MVC
          app.UseMvc(routes =&gt;
          {
              routes.MapRoute(
                  name: "default",
                  template: "{controller=Home}/{action=Index}/{id?}");
          });
  
          // Swagger
          app.UseSwagger(c =&gt;
          {
              c.PreSerializeFilters.Add((swagger, httpReq) =&gt; swagger.Host = httpReq.Host.Value);
          });
          app.UseSwaggerUI(
              c =&gt; { c.SwaggerEndpoint("/swagger/v1/swagger.json", "V1 Docs"); });
      }
  </code></pre>
  
  <p>ValuesController.cs</p>
  
  <pre><code>[ApiVersion("1.0")]
  [Route("api/v{version:apiVersion}/values")]
  public class ValuesController : Controller
  {
      // GET api/values
      [HttpGet]
      public IEnumerable&lt;string&gt; Get()
      {
          return new[] {"value1", "value2"};
      }
  
      // GET api/values/5
      [HttpGet("{id}")]
      public string Get(int id)
      {
          return "value";
      }
  
      // POST api/values
      [HttpPost]
      public void Post([FromBody] string value)
      {
      }
  
      // PUT api/values/5
      [HttpPut("{id}")]
      public void Put(int id, [FromBody] string value)
      {
      }
  
      // DELETE api/values/5
      [HttpDelete("{id}")]
      public void Delete(int id)
      {
      }
  }
  </code></pre>
  
  <p>Also, here is the version for all the libraries I have installed:</p>
  
  <pre><code>&lt;ItemGroup&gt;
    &lt;PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.8" /&gt;
    &lt;PackageReference Include="Microsoft.AspNetCore.Mvc.Versioning" Version="2.2.0" /&gt;
    &lt;PackageReference Include="Swashbuckle.AspNetCore" Version="2.4.0" /&gt;
  &lt;/ItemGroup&gt;
  </code></pre>
  
  <p>Does anyone see what I might be doing wrong?</p>