IIS Express - Getting SSL to Work

I cannot force IIS Express to accept secure connections for the VS2010 MVC3 project that I am developing. I can force it to accept insecure connections on port 80, but not protect them on port 443.

I have taken the following steps based on googling:

1) Print the SHA1 fingerprint for my self-signed IIS Express Server certificate by running the following on the VS2010 command line:

certmgr.exe /c /s /r localMachine MY 

The result is 9B088F80 A4FC3141 28F62890 70BA1FC4 49FDD009. Later, I found out that I needed to remove spaces when using the fingerprint.

2) Removed any certificate associated with port 443 by executing the following in an elevated command prompt request:

 netsh http delete sslcert ipport=0.0.0.0:443 

3) Generated a new GUID by running Create GUID from the Tools VS2010 menu. In my case, I received B0421A5B-FF61-47CE-892D-11AA3A9C7D2A.

4) Installed a self-signed certificate on port 443 by executing the following in a request of an elevated command line:

 netsh http add sslcert ipport=0.0.0.0:443 certhash=9B088F80A4FC314128F6289070BA1FC449FDD009 appid={B0421A5B-FF61-47CE-892D-11AA3A9C7D2A} 

5) Modified the ACL by running the following from an elevated command prompt:

 netsh http add urlacl url=https://localhost:443/ user=everyone 

6) Changed the application.config file for IIS Express by adding a binding for port 443 and the https protocol. The sites section for the file is as follows:

  <sites> <site name="Development Web Site" id="1" serverAutoStart="true"> <application path="/"> <virtualDirectory path="/" physicalPath="%IIS_BIN%\AppServer\empty_wwwroot" /> </application> <bindings> <binding protocol="https" bindingInformation="*:443:localhost" /> <binding protocol="http" bindingInformation="*:80:localhost" /> </bindings> </site> <siteDefaults> <logFile logFormat="W3C" directory="%IIS_USER_HOME%\Logs" /> <traceFailedRequestsLogging directory="%IIS_USER_HOME%\TraceLogFiles" enabled="true" maxLogFileSizeKB="1024" /> </siteDefaults> <applicationDefaults applicationPool="IISExpressAppPool" /> <virtualDirectoryDefaults allowSubDirConfig="true" /> </sites> 

7) Restart the http service by running the following command at a command prompt with an elevated command prompt:

 net stop http net start http 

8) The project URL on the Internet tab of my MVC project properties page has been changed to the following:

 http://localhost/ 

Saving the project property page caused server reconfiguration after I made this change.

When I run the MVC application from VS2010, it binds correctly to http: // localhost (by default, port 80, I did not turn on all the steps so that IIS Express works with insecure / normal connections on port 80, but they are essentially run from 5 to 7, but with an emphasis on http and port 80, not https and port 443).

However, when I try to switch to any action that requires https, I get a "server rejection" error message.

What am I doing wrong?

+59
ssl visual-studio asp.net-mvc iis-express
Apr 2 2018-11-11T00:
source share
4 answers

After you have configured the project to use IISExpress, press F4 when the project is selected in the solution explorer to display the properties and in the SSL Enable property settings set true and in the SSL URL set the URL with the port (443 in your case), which is required for SSL

This works for me without going under the hood, and the self-signed certificate was automatic.

To start a project at this URL by default, you can right-click on the project, select properties, then web and replace the project URL https: // localhost: 443

+75
Apr 6 2018-11-11T00:
source share

If you followed the jbtule steps and SSL still does not work, make sure your port is in the format :443XX .

Visual Studio did this automatically for the first project on which I turned on SSL, but any subsequent projects have random SSL ports. Changing it to the above 443 structure under the Project > Web interface got it and worked for me.

+7
Dec 29 '16 at 21:07
source share

I came across an answer.

In step 6, I modified the wrong application.config IIS Express file. It turns out there is a main configuration file in the application’s home directory (for example, C:\Program Files (x86)\IIS Express\AppServer , on my system), which I modified.

The second and correct file to modify is the one that is in the user data area (for example, C:\Users\Mark.ARCABAMA\Documents\IISExpress\config , on my system).

+6
Apr 03 2018-11-11T00:
source share

I just wanted to add a solution that helped me with the same problem.

VS showed an SSL URL that was https://[an IP, not localhost]:44367

The URL was reserved, which I found using netsh http show urlacl

Then I ran netsh http delete urlacl https://[an IP, not localhost]:44367 , rebooted VS, turned off SSL, set SSL to false, and then turned it back on. This fixed the SSL URL.

0
May 20 '19 at 11:53
source share



All Articles