Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I disable HTTPS in ASP.NET Core 2.1 + Kestrel?

So it appears with the advent of ASP.NET Core 2.1, Kestrel now automatically creates an HTTPS endpoint along side the HTTP one, and default project templates are setup to redirect from HTTP to HTTPS (which is easy enough to undo).

However my question is... how can I disable HTTPS entirely for my project. I've read through the docs and played with a variety of config settings for HTTPS but nothing I do seems to allow me to turn it off and just run an HTTP project.

Am I crazy or just missing something. I would expect this to be super easy to do.

like image 349
Xorcist Avatar asked Jun 19 '18 19:06

Xorcist


People also ask

How do I disable HTTPS in Visual Studio?

To fix this error, as suggested from this site: For an existing project configured for HTTPS, look at the properties pane for the application and set SSL Enabled from true to false. with message: "You can't remove SSL from this site because this Web project is currently configured to browse with this URL.

What is configure for HTTPS?

To configure an HTTPS server, the ssl parameter must be enabled on listening sockets in the server block, and the locations of the server certificate and private key files should be specified: server { listen 443 ssl; server_name www.example.com; ssl_certificate www. example.com.


2 Answers

In the Startup.cs, remove the middleware

app.UseHttpsRedirection(); 
like image 159
Tairan Avatar answered Sep 18 '22 20:09

Tairan


If you are using Visual Studio 2017, then you can do the following:

  1. Go to your project properties. (Right-click > Properties)
  2. Click on the Debug tab.
  3. Under Web Server Settings, deselect Enable SSL.
  4. Save, build, and try again.

This will update the iisExpress settings in the launchSettings.json file.

like image 28
Abhishek Kumar Avatar answered Sep 17 '22 20:09

Abhishek Kumar