
IISExpress, bundled with Visual Studio, provides a lighter-weight web server than the full IIS (Internet Information Services) Windows service, and is useful for running up and debugging web code projects.
Something you may eventually come across is a need to run your web project securely (using SSL), and when that time comes hopefully IISExpress will work fine. If it doesn’t there are a few reasons why that might be the case.
By default, Visual Studio should assign your code project a random host port on which IISExpress will run. Most of the time this is an unused port and you never have any issues running/debugging your project.
Occasionally, however, you may come across an annoying issue where IISExpress won’t spin up. The most likely reason for this is described fairly clearly with an error message like ‘port in use: 54024’.
The problem can be exacerbated if you are also using SSL and IISExpress needs to host a secure connection for your web project. In this case the above error message may be confusing because the port referenced in the message may not even be the one you are using for your HTTPS connection.
There could be a few reasons IISExpress won’t run as expected.
The obvious one is that the error message is correct and the port number is being used by another service on the machine. Changing the host port number in the code project’s properties is often enough to fix the issue in this case.
If changing the number doesn’t fix the problem then there are a few things to look at.
First of all, if you are hosting over HTTPS, what port number has been configured in the code project properties? IISExpress only supports hosting of secure connections on ports 44300 – 44399.
This restriction is in place because when IISExpress is installed it configures the machine to allow connections on ports in that range to be established without requiring administrator privileges (so Visual Studio can run in normal user mode, launch IISExpress, and is able to host a HTTPS session).
So, if your project isn’t configured to host secure connections on a port in that range then the first step is to change the port number and try again.
Assuming you haven’t fixed your issue yet, a lesser known cause of the issue can be because a port number is referenced in the applicationhost.config file associated with the code project.
There should be a .vs folder either at the solution folder level or the code project root folder level. Within this there is likely to be a folder named after your solution and a sub-folder called ‘config’. Within this last folder the applicationhost.config file should reside. If port numbers are referenced in that file then they will override the ones set up in the local code project properties and this could be why your project won’t run. Simply change the port numbers to something valid (e.g. to ports in the range supported by IISExpress) and the project should then run successfully.