255

Some web projects are causing me problems while others work fine. I decided to focus on one of the problematic ones. I'm using Visual Studio 2013 on Windows 7. I think I'm running it as administrator, the window title says PROJECT NAME - Microsoft Visual Studio (Administrator).

When I try to run the project I get a popup saying:

Unable to launch the IIS Express Web server.

Failed to register URL "http://localhost:62940/" for site "SITE NAME" application "/". Error description: Access is denied. (0x80070005).

This does not seem entirely uncommon but I have tried many of the suggestions without luck:

  1. Deleted %userprofile%\Documents\IISExpress\, tried to run.

  2. netsh http add urlacl url=http://localhost:62940/ user=everyone, rebooted and tried to run. (Actually user=Alla since Swedish Windows).

  3. netsh http delete urlacl url=http://localhost:62940/, rebooted and changed from <binding protocol="http" bindingInformation="*:62940:localhost /> to <binding protocol="http" bindingInformation="*:62940:/> in %userprofile%\Documents\IISExpress\config\applicationhost.config and tried to run. (It did changed the error message to say ... URL "http://*:62940/" ....

  4. Reinstalled IIS 8.0 Express

  5. Reinstalled Visual Studio 2013

I'm at my wit's end, what am I doing wrong?

If I change the port of the project (e.g. to 55555) it starts... This is not a desirable solution since these projects are worked on by several people. Maybe the port is blocked by something else? If so, is there an easy way to check by what?

Port 62940 seems to be free. Running netstat does not show any application listening to it. Something else must be wrong.

I tried starting the project today after not touching it for a few months. It worked but I don't know why.

4
  • 2
    Run netstat -aon | findstr to see if another application also monitors port 62940. If so, you cannot monitor that port but have to switch to another port. Don't change applicationHost.config or netsh http when they are obviously not the cause. Commented May 7, 2014 at 9:21
  • I ran netstat as suggested. No application seems to be monitoring port 62940. Something else must be wrong. Commented May 9, 2014 at 10:48
  • 3
    Rebooting worked for me. Commented Oct 7, 2015 at 13:35
  • Restarting VS solved the issue for me. Commented Apr 1, 2022 at 13:00

43 Answers 43

202

This is the only solution I found

net stop winnat

net start winnat

Thanks to Matt

Sign up to request clarification or add additional context in comments.

19 Comments

This worked for me in Nov 2022 using Win10! Thanks
Worked for me in Windows 11. June 2023.
Worked for me in Dec 2023 on a NET Core Web API project using IIS Express. This is the Windows Network Address Translation (NAT) service. By doing this, you effectively release and then reassign the ports that the NAT service is managing, which can clear up any port conflicts without having to identify and terminate specific processes. Rebooting the machine didn't work and I couldn't kill the PID that was responsible either.
Worked for me in August 2024, VS2022 Windows 10!!! Nothing else here or anywhere else on the Internet that I could find worked (without a reboot, which I was trying to avoid since I wasn't sure it would be effective). A reboot would also have likely resolved this since all services would have been restarted, but if someone wants this fixed without having to reboot this one is it.
worked for me in Feb/24/25
|
120

Yeah, I agree, top answers are really pro solutions. Here is one for intermediates:

Solution Explorer

  1. Right click on project select Unload project
  2. Again Right click and select Edit ProjectName.csproj
  3. Remove these 3 lines
<DevelopmentServerPort>0</DevelopmentServerPort>
<DevelopmentServerVPath>/</DevelopmentServerVPath>
<IISUrl>http://localhost:62940/</IISUrl>
  1. Save and reload the project, and you are good to go.

1 Comment

Anybody else who gets here, I had to delete in .csproj, and also .csproj.user. FWIW
104

I solved the error by changing the port for the project.

I did the following steps:

1 - Right click on the project.
2 - Go to properties.
3 - Go to Server tab.
4 - On tab section, change the project URL for other port, like 8080 or 3000.

Good luck!

1 Comment

This is not working in 2022 as the option is not available any more as of June 2023
75

try (as elevated administrator)

netsh http delete urlacl url=http://*:62940/

3 Comments

This helped, but in my case was not sufficient. I also had to add the proper url back using netsh http add urlacl url=http://localhost:62940/ user=Everyone
This still didn't solve the problem for me - maybe due to the way localhost routes are mapped? I had to replace localhost with a * wildcard, like this: netsh http add urlacl url=http://*:62940/ user=Everyone
In my case - no one using the port in this list...
66

The ideal way to sort this out is to use the IIS Express tray icon to stop the web site that is causing the problem. To do this, click the little upward-pointing arrow in the right-hand end of the task bar and right-click the IIS Express icon. This will pop up a small window showing you the web sites that IIS Express is currently running...

IIS Express pop up

If you click on one of the items under "View Sites" you have the option to stop that site. Or, you can click the Exit item at the bottom of the window to stop all web sites.

That should enable you to debug in Visual Studio. When you start debugging again, IIS Express will automatically restart the web site, and should be able to allocate the port.

If that fails, you have to do it the dirty way. Open Windows Task Manager and kill the Microsoft.VisualStudio.Web.Host.exe*32 process, then you can run the project fine. Note that this will kill IIS Express completely, meaning that all web sites will stop, so you'll have to restart each one in VS if you want to debug any others. Try the pop-up icon method first tough as it's cleaner and safer.

Don't know if this answers your issue, but it works for me.

Update Thanks to JasonCoder (see comment below) for adding that on Win10, the process is Microsoft.VsHub.Server.HttpHost.exe

Comments

60

When using Visual Studio 2015 the solution can be a bit different to the previous answers. VS2015 creates a hidden folder .vs under the same folder as your solution file. Under this is a config folder containing applicationhost.config. Deleting this file (or the entire .vs folder) then starting VS2015 to recreate it can fix this error.

Comments

60

I got the same issue when running my application from Visual Studio 2019 on Windows 10. After some time googling and trying various proposed solutions without success, I determined that the "Access Denied" error was a result of the port number my application uses (50403) falling in an "excluded port range".

You can view the excluded port ranges with the following command:

netsh interface ipv4 show excludedportrange protocol=tcp

After some more time googling I found that the two most likely culprits that create these exclusion ranges are Docker and Hyper-V. Docker was not installed on my computer but Hyper-V was.

My Solution

  1. Disable Hyper-V: Control Panel-> Programs and Features-> Turn Windows features on or off. Untick Hyper-V
  2. Restart the computer.
  3. Add the port you are using to the port exclusion range: netsh int ipv4 add excludedportrange protocol=tcp startport=50403 numberofports=1 store=persistent
  4. Reenable Hyper-V
  5. Restart the computer

I added the port I am using to the exclusion list to ensure that I won't get this problem again after reenabling Hyper-V. After Step 4 and 5 when I viewed the excluded port range I can see that Hyper-V reserved a port range starting with the next port after my port.

Excluded Port Range

My application now worked perfectly!

3 Comments

Why would adding the port to the exclusion list help? Does it not mean TCP is not longer able to use the port?
@ANewGuyInTown I think you need the port exclusion in place when re-enabling Hyper-V. Once Hyper-V has grabbed other ports the exclusion can be removed.
This did work for me when a number of the other suggestions did not. I should note, I have not (yet) reenabled HyperV -- don't need it at the moment.
57

Got this error as well lately. Tried all the above fixes, but none worked.

To disable it, type services.msc in command prompt, then right click and disable Internet Connection Sharing. I edited the properties of it as well to disable at startup. Mine looks like so now: services capture screenshot.

3 Comments

I am using VS2022 and this answer helped me. Tried few other solutions but only this one worked. Quick and easy fix.
I was not able to stop this service. I believe that's because I had Hyper-V services running, and those services require ICS. If you're having this problem and need Hyper-V, see this other answer.
This works. Because I was using windows 10 Mobile Hotpot to share my internet connection. just turned off the mobile hotspot and works. Thanks. moreover, ChatGPT was not able to give any solution. I had to browse through all the answers given in stack overflow, which tells you that this community is much much better than an AI.
35

This happened with me when I was trying to access my site from a remote location:

At first, applicationhost.config (VS2015) contained the standard:

<binding protocol="http" bindingInformation="*:64376:localhost" />

In order to access my site from a remote location within the network, I added (step 1):

<binding protocol="http" bindingInformation="*:64376:192.168.10.132" />

Then, I entered into CMD with Admin rights (step 2):

netsh http add urlacl url=http://*:64376/ user=Everyone

As step 3, I added it a rule to the firewall.

netsh advfirewall firewall add rule name=”IISExpressWeb” dir=in protocol=tcp localport=64376 profile=private,domain remoteip=localsubnet action=allow

Then, I got this error when trying to run the solution again.

Solution: I seemed to have done everything right, but it did not work until I ran netsh also for the existing localhost rule:

netsh http add urlacl url=http://localhost:64376/ user=Everyone

Now, it works again.

Comments

28

I just had a similar issue. I'm not totally sure how to describe the actual fault but it seems like the hostname in the reservation is incorrect. Try this in an elevated command prompt...

netsh http delete urlacl url=http://localhost:62940/

... then ...

netsh http add urlacl url=http://*:62940/ user=everyone

and restart your site. It should work.

Comments

27

I ran into this same error message, but it looks like it was produced from IIS Express. This article helped me resolve it

TL;DR

Run the following command from an Administrative command prompt:

> netsh http add iplisten ipaddress=::

1 Comment

I wanted to add an update if you found this answer - this also helped with an SSL/TLS error in IIS Express in Windows 11: blog.codeinside.eu/2018/10/31/… Essentially running: C:\Program Files (x86)\IIS Express\IisExpressAdminCmd.exe setupsslUrl -url:https://localhost:<YOUR_PORT_NUMBER>/ -UseSelfSigned
23

After trying a number of suggested solutions without success I just rebooted my PC. After that the problem didn't occur anymore.

Comments

15

I ended up with cleaning the project file (csproj) and the applicationhost.config (iis express) with all entries regarding iis express configuration. After that, it worked.

1 Comment

Cleaning out the applicationhost.config file worked for me. I just deleted all of the <site> entries in it. C:\Users\<USERNAME>\Documents\IISExpress\config\applicationhost.config
13

If you're having this after installing Visual Studio 2015 and you can see Error messages in System event log such as this: Unable to bind to the underlying transport for [::]:{your_port}. . The IP Listen-Only list may contain a reference ... then you might be missing a registry entry.

Run this under administrative command prompt: netsh http add iplisten ipaddress=:: to fix it.

I found the solution described in detail here

Comments

10

After all of the steps listed here failed for me I got it working by running VS2015 as administrator.

Comments

9

Got the same issue where IIS express complained about http://localhost:50418/ and none of above solutions worked for me..

Went to projektFolder --> .vs --> config --> applicationhost.xml

In the tag <sites> I found that my web app had two bindnings registered.

<site name="myApp.Web" id="2">
    <application path="/" applicationPool="Clr4IntegratedAppPool">
        <virtualDirectory path="/" physicalPath="C:\git\myApp\myApp.Web" />
    </application>
    <bindings>
        <binding protocol="https" bindingInformation="*:44332:localhost" />
        <binding protocol="http" bindingInformation="*:50418:localhost" />
    </bindings>
</site>

Removing the binding pointing to *:50418:localhost solved the issue.

Using VS2017 and IISExpress v10.

3 Comments

Actually there are always two bindings, because those are for different protocols. I always worked with these without problem, it uses the port according to the used protocol. It is not correct to remove those... The problem is somewhere else...
This worked for me, I had to remove some rogue bindings that where injected at this location. I kept the two default bindings. If you use VS2019 or VS2022, you find this file here: $(solutionDir)\.vs\{projectName}\config\applicationhost.config. If you use IIS Express stand alone, you find the file here: %userprofile%\documents\iisexpress\config\applicationhost.config.
Thanks @Stefan your comment (along with Marcus' answer) worked. I was checking the \.vs\ folder in my project directory. I hadn't thought of also checking the one in the solution directory.
6

This happened to me on Windows 10 and VS 2013. Apparently there is a maximum port number IIS Express handles. Ports above 62546 don't work for me.

1 Comment

I can't be sure if or what the max is. However, I was suffering from this error. I then deleted %userprofile%\Documents\IISExpress and edited my .csproj file, moving from port 63584 to 61111. After reloading, my project started just fine.
4

The error can be solved if you just restart Visual Studio. It has the same effect as restarting the Microsoft.VisualStudio.Web.Host.exe*32 process.

Comments

4

Running netstat -abn I noticed that the software "Duet Display" was reserving thousands of ports in the ~51000 range.

Closing it solved my problem.

Comments

4

In Visual Studio 2019 Just remove Debug profile and create new one Do the Trick

  1. Go to Project properties In debug tab
  2. try first Changing ports Web Server Settings
  3. if Changing ports not worked then Remove Debug Profile and Create new One-Warning Make Sure You Know Previous Settings

Comments

3

Sometimes this error my be another Visual Studio version running on the same machine.

Comments

3

Go to the project "Properties" => "Web", and on the "Servers" section change the port to something else that is not used in and save it. You will be asked to created a virtual directory and click "Yes". Now run the project and it will work now.

1 Comment

This is the exact same answer as Francisco wrote 3 weeks prior.
3

In my case it worked at first and after a while stopped working and IIS Express reported that the port was in use.
netstat -ab showed that Chrome was using the port. After I quit Chrome, it started working again.
I am not sure however, why Chrome would occupy that port.

1 Comment

This worked for me. I was using Browse With and switching between Firefox and Chrome without running the debugger. Something must have gotten hung up in the process. (Win7/VS2015)
3

This happened to me on Windows 7 and VS 2013 while viewing a project on the browser after build. I only had to close the browser "Chrome" then made sure that the port is not in use in my Network Activities using some utility (Kaspersky) then tried again and worked without any problems.

Comments

3

In Visual Studio 2015:

  • Find your startup page in your project (eg: mypage.aspx) , and right click on it.
  • Click on Set as Start Page.
  • Right click on the project.
  • Click on Properties.
  • Click on the Web Tab on the left.
  • In Project URL, enter a different port, such as: http://localhost:1234/
  • In Start Action, select Specific Page: mypage.aspx or select Specific URL: http://localhost:1234/mypage.aspx?myparam=xxx

Comments

3

My issue turned out to be that I had SSL Enabled on the project settings. I simply disabled this because I did not require SSL for running the project locally.

In Visual Studio 2015:

  • Select the project in the Solution Explorer.
  • In the Properties window set SSL Enabled to False.
  • I was able to run the project.

In my situation I was getting an error about port 443 in use because this was the port set on the SSL URL for the project.

2 Comments

I had the inverse of this, I actually needed to enable SSL on my project. Good to see I'm not the only person who saw this error due to SSL.
I had to do this to set it to using ssl and then back to not (my app is not supposed to use ssl)
3

I solved this issue by killing all instances of iexplorer and iexplorer*32. It looks like Internet Explorer was still in memory holding the port open even though the application window was closed.

Comments

3

I had this issue with JetBrains Rider, specifically for port 80 and 90 bit it was working with other ports as well as visual studio.

after running as admin this resolved the issue.

Comments

3

What worked for me is disabling all other network adapters, except the one I'm currently using. The event in event viewer was: Unable to bind to the underlying transport for [::]:50064. The IP Listen-Only list may contain a reference to an interface which may not exist on this machine. The data field contains the error number.

Since I have VMware Workstation, Docker (and thus Hyper V) some VPN clients, I have a lot of network interfaces.

Comments

2

This is for Visual Studio 2019, After trying a lot of suggestions that failed to work (including changing the port number etc) I solved my problem by deleting a file that was generated on my project's root folder called "debug". As soon as this file was deleted everything started working.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.