How to enable an ASP.NET Core Web application to run over https with Visual Studio 2017

I was trying to follow the “Enabling authentication using Facebook, Google and other external providers” official Microsoft documentation for ASP.NET Core Web Applications.

My machine is a Windows 10 device with Visual Studio 2017 RTM.

The documentation in my opinion can be improved.

First thing to do is to enable SSL in the Project Properties:


After you select the Enable SSL check box a new URL is defined.  Copy-Paste that new URL in the APP Url textbox.


Then open the LaunchSetting.json file and make the following changes.  Please note that i am using the same URL and SSL port that were defined when i selected the Enable SSL checkbox.

After that you have to modify the Startup.cs file:

That is basically what the Microsoft documentation says.  But after trying to debug the project the following mistake was shown by Visual Studio 2017:

An error occurred attempting to determine the process id of the dotnet.exe process hosting your application.


The issue here, after hours of research, is that we have to do some changes in the certificates deployed in our development machines.  I was able to resolve the issue by reading the following answer in StackOverflow:  Thank to for the answer

The problem is that the certificate that was installed automatically for you by Visual Studio is not trusted. You can locate the certificate in the Personal folder of the computer-level certificates in the certificates snap-in.  Open the Certificates snap in:

If you double-click the certificate you’ll see that it’s not trusted:

The message also provides the solution: the certificate must be imported into the trusted root certification authorities folder. You’ll see that as a folder in the same snap-in just below “Personal”. So how can we do that? Right-click the certificate, then select All Tasks, Export… from the context menu. Click Next on the certificate export wizard. Leave the “Do not export the private key” option untouched, click Next. Accept the default on the next screen, i.e. “DER encoded binary X.509” should stay selected, then click Next. Then you’ll need to provide a name and a location for the exported file. Call it “localhost” and save it in a location where you can easily find it. Click Next and the Finish. There should be a popup message saying that the export was successful. Next right-click the folder called Trusted Root Certification Authorities and select All Tasks, Import… from the context menu. Leave the “Local Machine” option untouched in the certificate import wizard, click Next. Browse to the certificate you saved just before. Click Next and accept all the default values along the way until you reach the end of the wizard. There should be a message saying that the import was successful. If you now go back to the Personal store and double-click the localhost certificate then you should see that it’s trusted:

OK, let’s start the ASP.NET Core Web project again, the opening page should open without any warning. If you still see the same issue then test it a brand new browser session.


Leave a Reply

Your email address will not be published. Required fields are marked *