IIS Express will occasionally not be able to start on a particular port with this error.

Unable to connect to Web Server IIS Express

In some cases, it's because another app is using that port. But often the reason is that Hyper-V has reserved one or more of the ports. To see which ports are currently excluded/reserved, run this command.

Note: all commands are in PowerShell 7 and should be run as Administrator

netsh int ipv4 show excludedportrange protocol=tcp

The result may look something like this.

Start Port    End Port
----------    --------
     50000       50059     *
     54675       54774
     54840       54939
     54940       55039
     55040       55139
     55140       55239
     55329       55428
     55429       55528

As far as I can tell, Hyper-V doesn't have a known port range it will attempt to use and work around. So, the solution is to exclude the individual ports your projects require.

You can check which ports the apps use by looking at the launchSettings.json files (assuming .NET Core). Be sure to include both the HTTP and SSL ports. Let's say, across all your projects, IIS Express will need to run on ports 44431,44435,54700,54701.

  1. Disable Hyper-V
    dism.exe /Online /Disable-Feature:Microsoft-Hyper-V
  2. Restart when prompted
  3. Run this script, substituting your ports
    $ports = 44431,44435,54700,54701
    foreach ($port in $ports) { 
        netsh int ipv4 add excludedportrange protocol=tcp startport=$port numberofports=1 
  4. Reenable Hyper-V
    dism.exe /Online /Enable-Feature:Microsoft-Hyper-V /All
  5. Restart when prompted


Error: The process cannot access the file because it is being used by another process.

If you get this error when running netsh to exclude the port, the port is already excluded. It's a confusing error message.

Windows could not start the Hyper-V Virtual Machine Management service on Local Computer. Error 0x8007000e: Not enough memory resources are available to complete this operation.

If you attempt to start the Hyper-V Virtual Machine Management service and get this error, it can be caused if the Hyper-V Host Compute Service is Disabled. Open Services and set that service as Manual.