I have a web application that behaves differently depending on the hostname. To test it on my local PC, I will then need to arrange for IISExpress to run the web application using a specific name that I provide in Project -> Properties -> Debug, such as http://mywebsite:58981/.
But when start debugging, a pop up message "Unable to connect to web server 'IIS Express'" pops up. And Windows 10 activity center alerted me of a message and upon clicking it, I received this pop-up from IIS Express:
I tried what other users suggested such as deleting the .vs folder containing the applicationhost.config and restarted the solution, but it still doesn't work. I even made sure that IIS Express doesn't have anything else running:
But if I changed the App URL back to http://localhost:58981/, deleted the .vs folder, and open the solution, I can debug as usual.
So my question is: how do I change the URL from localhost to something else? I'm running Visual Studio 2019 and my Windows 10 is 1903 edition.


