I am testing SSL
Encryption on my local PC which requires me to change my ASP.MVC Project URL
from http://localhost:xxxx
to something like http://payroll.net:81
.
When I run this application, ASP.MVC is probably not loading the project on this URL. Browser is giving the following error:
The server at payroll.net can't be found, because the DNS lookup failed. DNS is the network service that translates a website's name to its Internet address. This error is most often caused by having no connection to the Internet or a misconfigured network. It can also be caused by an unresponsive DNS server or a firewall preventing Google Chrome from accessing the network.
I have to mention that I have updated hosts
file in ../WINDOWS/System32/drivers/etc/
location as:
127.0.0.1 payroll.net:81.
I also have to mention that if I run the same project under default Project URL
that IISExpress
uses i.e., http://localhost:xxxx
, project runs all good. Any idea on how this project can be run with http://payroll.net:81
URL on IISExpress?
hosts file can't resolve IP addresses to hostname if port is specified with the IP address. So
127.0.0.1 payroll.net:81
is wrong
and
127.0.0.1 payroll.net
is correct
Now you can safely open https://payroll.net:81. (which now automatically maps to https://localhost:81) Just make sure the site is hosted on IISExpress on port 81 and ssl is enabled
The point I wanted to demonstrate in my first comment was that SSL testing does not require you to change your url from http://localhost:xxxx to https://payroll.net:81 (As mentioned in your question). For SSL testing. you can just host your site to any different unused port without changing hosts file e.g https://localhost:91
My comments and their verification in Rehan Khan's answer