Failed to register URL “http://localhost:64831/” for site “Development Web Site” application “/”. Error description: Access is denied. (0x80070005)

Diagnose

Port exclusions can be reserved by Docker or Hyper-V that conflict with the port used by IIS Express for a given project. You can verify this your issue with the following command to list the excluded port ranges.

netsh interface ipv4 show excludedportrange protocol=tcp

Protocol tcp Port Exclusion Ranges

Start Port    End Port
----------    --------
     49787       49886
     50000       50059     *
     50160       50259
     50260       50359
     51212       51212     *
     56464       56563
     56580       56679
     57010       57109
     64808       64909     

In this case the range 64808 - 64909 is the cause and IIS Express will not be able to use it.

Fix

The following procedure will reserve the port used by the project.

  1. Navigate to Windows features on or off
  2. Turn off the Hyper-V feature
  3. Reboot
  4. Reserve the port using the command:
    netsh int ipv4 add excludedportrange protocol=tcp startport=64831 numberofports=1 store=persistent

Run the following to verify the port has been reserved:

netsh interface ipv4 show excludedportrange protocol=tcp

Protocol tcp Port Exclusion Ranges

Start Port    End Port
----------    --------
     49787       49886
     50000       50059     *
     50160       50259
     50260       50359
     51212       51212     *
     56464       56563
     56580       56679
     57010       57109
     64831       64831     *

* - Administered port exclusions.