title: How do you disable HTTPS in ASP.NET Core project with Identity?
body: <p>I have recently created an ASP.NET Core 3.0 web application project in Visual Studio 2019 (with Docker enabled, but I don't think that's relevant), and don't seem to be able to disable HTTPS when including ASP.NET Identity for individual user accounts. Whenever I launch the app in the debugger the page opens using HTTPS and navigating to HTTP redirects me back again.</p>
  
  <p>I've tried creating a new project to test out what is going on, and have found the following:</p>
  
  <p>When creating the project I enabled the use of ASP.NET Identity in order to use local accounts in my app, and I noticed that if I go through the wizard again in order to create a project with the same setup (web app with Identity enabled for individual user accounts) the option to untick the box enabling HTTPS appears to be greyed out.</p>
  
  <p><a href="https://i.stack.imgur.com/CZuwz.png" rel="noreferrer"><img src="https://i.stack.imgur.com/CZuwz.png" alt="Unable to disable HTTP on project creation with Identity"></a></p>
  
  <p>After creating the project, I've tried disabling the HTTPS redirection middleware in <code>Startup.cs</code> by commenting out the relevant line:</p>
  
  <pre><code>public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
          {
              if (env.IsDevelopment())
              {
                  app.UseDeveloperExceptionPage();
                  app.UseDatabaseErrorPage();
              }
              else
              {
                  app.UseExceptionHandler("/Home/Error");
                  app.UseHsts();
              }
              //app.UseHttpsRedirection();
              app.UseStaticFiles();
  
              app.UseRouting();
  
              app.UseAuthentication();
              app.UseAuthorization();
  
              app.UseEndpoints(endpoints =&gt;
              {
                  endpoints.MapControllerRoute(
                      name: "default",
                      pattern: "{controller=Home}/{action=Index}/{id?}");
                  endpoints.MapRazorPages();
              });
          }
  </code></pre>
  
  <p>And have edited the <code>launchSettings.json</code> to try to get the app to run using HTTP instead of HTTPS when debugging, but the app still tries to load using HTTPS.</p>
  
  <p><code>launchSettings.json</code> BEFORE:</p>
  
  <pre><code>{
    "iisSettings": {
      "windowsAuthentication": false,
      "anonymousAuthentication": true,
      "iisExpress": {
        "applicationUrl": "http://localhost:51767",
        "sslPort": 44396
      }
    },
    "profiles": {
      "IIS Express": {
        "commandName": "IISExpress",
        "launchBrowser": true,
        "environmentVariables": {
          "ASPNETCORE_ENVIRONMENT": "Development"
        }
      },
      "HTTPSTest": {
        "commandName": "Project",
        "launchBrowser": true,
        "environmentVariables": {
          "ASPNETCORE_ENVIRONMENT": "Development"
        },
        "applicationUrl": "https://localhost:5001;http://localhost:5000"
      },
      "Docker": {
        "commandName": "Docker",
        "launchBrowser": true,
        "launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}",
        "environmentVariables": {
          "ASPNETCORE_URLS": "https://+:443;http://+:80",
          "ASPNETCORE_HTTPS_PORT": "44397"
        },
        "httpPort": 51777,
        "useSSL": true,
        "sslPort": 44397
      }
    }
  }
  </code></pre>
  
  <p><code>launchSettings.json</code> AFTER:</p>
  
  <pre><code>{
    "iisSettings": {
      "windowsAuthentication": false,
      "anonymousAuthentication": true,
      "iisExpress": {
        "applicationUrl": "http://localhost:51767"
      }
    },
    "profiles": {
      "IIS Express": {
        "commandName": "IISExpress",
        "launchBrowser": true,
        "environmentVariables": {
          "ASPNETCORE_ENVIRONMENT": "Development"
        }
      },
      "HTTPSTest": {
        "commandName": "Project",
        "launchBrowser": true,
        "environmentVariables": {
          "ASPNETCORE_ENVIRONMENT": "Development"
        },
        "applicationUrl": "http://localhost:5000"
      },
      "Docker": {
        "commandName": "Docker",
        "launchBrowser": true,
        "launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}",
        "environmentVariables": {
        },
        "httpPort": 51777
      }
    }
  }
  </code></pre>
  
  <p>Does anyone have any ideas of what I can try next? I want the app to sit behind an SSL-terminating reverse proxy, so I don't think it's unreasonable to want to disable this.</p>