I have VS2013 set up with IIS Express to use a custom domain as follows:
http://mydomain.local
https://mydomain.local
The port 80 url works great, the port 443 does not (Bad Request, Page Cannot Be Displayed, aka site doesn't exist).
Why?
Clearly IIS Express is struggling to map or use port 443 with this name, but why?
applicationhost.config:
<site name="MyDomain" id="16">
<application path="/" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="C:\Projects\MyDomain" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:80:MyDomain.local" />
<binding protocol="https" bindingInformation="*:443:MyDomain.local" />
</bindings>
</site>
hosts file:
127.0.0.1 MyDomain.local
VS Project Properties:
Start Url, Project Url, and Override application root URL are all https://MyDomain.local
.
Clicking Create Virtual Directory
results in NO errors because it is happy with the config in applicationhosts.config.
NOTE: with the above settings alone, http://mydomain.local
(port 80) works fine!
Further, looking at the properties window on the project node, all settings are as expected:
SSL Enabled: True
SSL URL: https://mydomain.local
URL: http://mydomain.local
Also, looking at IIS Express in the task bar, these show up as expected for 443 and 80 respectively.
Going Ninja:
It should not be necessary (seems how http:// works without doing this), but I ran netsh for this just to be sure the URL is registered:
netsh http add urlacl url=https://MyDomain.local:443/ user=Everyone
This of course results in an error "... already exists". So then I run:
netstat -o
TCP 127.0.0.1:80 mydomain:2063 ESTABLISHED 4
TCP 127.0.0.1:2063 mydomain:http ESTABLISHED 2276
...
I see nothing camping on port 443. No, Skype is not installed on this machine! (a supposedly common issue).
I am at a total loss. What the heck? This is not rocket science.
Environment:
- Windows 10
- VS 2013 Update 5 (running as admin)
Other Info:
I have researched this like crazy. Many articles on Stack Overflow and elsewhere. Here are just a couple of prime ones:
Using Custom Domains With IIS Express
and http://www.hanselman.com/blog/WorkingWithSSLAtDevelopmentTimeIsEasierWithIISExpress.aspx
I have tried everything I can see that is logical to do. For the issue I am raising, the resolution is to set all the settings I just described. Since that doesn't work, it warrants a post of its own!
What am I missing?
Based on the linked blog below, you need to bind a certificate to port 443. IIS Express has already bound ports 44300 to 44399 to a local certificate for local https development.
I have not tried it, but (the bottom section of) this blog shows how you can bind to port 443 the existing local certificate IISExpress uses for ports 44300 to 44399.
Run IISExpress on port 443 using SSL and wildcard subdomains