210

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.

TylerH
  • 20,816
  • 57
  • 73
  • 92
Linus
  • 3,100
  • 4
  • 21
  • 34
  • 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. – Lex Li May 07 '14 at 09:21
  • I ran `netstat` as suggested. No application seems to be monitoring port 62940. Something else must be wrong. – Linus May 09 '14 at 10:48
  • 2
    Rebooting worked for me. – Patrick Borkowicz Oct 07 '15 at 13:35
  • Restarting VS solved the issue for me. – gajama Apr 01 '22 at 13:00

42 Answers42

98

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!

Francisco
  • 1,700
  • 1
  • 16
  • 19
  • 9
    just kill the `Microsoft.VisualStudio.Web.Host.exe*32` process as Avrohom Yisroel says. – rotgers Jan 28 '16 at 19:28
  • Also worked for me on ASP.NET Core 1.0 RC1, although it is now in Debug tab and I had to toggle SSL Enable off and on again to generate a new port then copy that to Launch URL box. http://stackoverflow.com/a/35706891/134761 – angularsen Feb 29 '16 at 18:32
  • 51
    Why upvote this? This is not a solution, is a workaround – Paleta Jul 08 '16 at 18:03
  • Like @rotgers said, I had to kill a process. But mine was ServiceHub.Host.CLR. I had 5 of them or something, and killed those I could. Then iis unlocked. – MartinJH Oct 11 '17 at 13:21
  • If you are using VS 2017 to run your application, go under the 'Web' tab and change the port in the Project Url – Fortune Apr 10 '18 at 09:57
  • This solution makes sense if there's an actual conflict as shown by netsh http show urlacl. E.g. mine showed a Reserved UR: http://+:3387/rdp/ . I suspect you wouldn't want to use solutions below that just delete that in that case. Choosing a new one worked. – Walter de Jong May 18 '20 at 00:58
  • `Why upvote this?`: because out of the 45 suggestions in this thread, this is the only one that worked :D – felickz Sep 17 '21 at 15:36
86

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.
Druid
  • 6,348
  • 3
  • 38
  • 53
65

try (as elevated administrator)

netsh http delete urlacl url=http://*:62940/
Spongman
  • 9,087
  • 7
  • 36
  • 56
  • 3
    This actually worked for me. I believe I had to reserve the port in MSVS 2010 for some reason and then upgraded to 2013 (express) and began getting the error. I tried delete and then add (localhost -> '*') which didn't work. Then just the delete with no add and it worked. – crokusek Sep 06 '14 at 01:54
  • 3
    This worked for me too, but only when run as Administrator. Otherwise it stated it couldn't find the file. – Seth Jun 28 '16 at 13:43
  • 3
    Try `netsh http show urlacl` to look for the conflicting entry. – shlgug Nov 30 '16 at 20:30
  • This worked for me with netsh http delete urlacl url=http://*:62940/ to recreate the reservation – eka808 Dec 29 '16 at 15:29
  • 8
    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` – sboisse Mar 24 '17 at 21:20
  • Note that *, 127.0.0.1 and localhost are treated as separate... netsh http delete urlacl url=http://*:10001/ netsh http add urlacl url=http://*:10001/ user=everyone netsh http delete urlacl url=http://127.0.0.1:10001/ netsh http add urlacl url=http://127.0.0.1:10001/ user=everyone netsh http delete urlacl url=http://localhost:10001/ netsh http add urlacl url=http://localhost:10001/ user=everyone – Stefan Steiger Apr 05 '17 at 16:49
  • 13
    URL reservation delete failed, Error: 2 The system cannot find the file specified. – Toolkit May 24 '17 at 10:15
  • Worked perfectly - thanks so much for posting this it has been driving me nuts! – ProNotion May 14 '18 at 20:11
  • In the case of `URL reservation delete failed`, it might be because you used a wildcard and the entry has a full IP – Savage Oct 31 '19 at 13:04
  • In my case, I did not need to delete any `urlacl`s (but looking at `netsh http show urlacl` was instructive). To give minimal permissions to launch IIS Express, with a custom hostname, I used: `netsh http add urlacl url=http://custom-hostname:49999/ user=%USERDOMAIN%\%USERNAME%`. – Martin_W Apr 06 '22 at 22:18
65

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

Avrohom Yisroel
  • 6,812
  • 7
  • 43
  • 81
  • 3
    Microsoft.VsHub.Server.HttpHost.exe was what it was for me on Windows 7 with VS2015 – JCisar Aug 02 '16 at 14:14
  • This process runs again when I try to run the project. How do I get rid of it? – nmit026 May 05 '17 at 06:39
  • 2
    @nmit026 The process is supposed to run again, that's what runs your web site. The purpose of killing it is to free up the lock it seems to have on the port. When you next run, it restarts the process, and allocates the port correctly. – Avrohom Yisroel May 07 '17 at 13:00
  • This is such a basic solution to what is otherwise a basic problem and I'm so glad someone put it out there. – Freerey Jan 19 '22 at 15:52
58

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.

Cayne
  • 697
  • 5
  • 4
  • I didn't have to restart VS2015, just try to restart the application. Also, I had to click "Create Virtual Directory" in the web tab of the project properties pages. – Doug Lampe Nov 10 '16 at 17:23
  • My problem was that another project's .vs/config/application...config was using the port. Once I had removed the port from that application config I was good to go. – James McDonnell Dec 22 '16 at 00:13
  • I had the same problem. I solved it by looking for this port in applicationhost.config. There should be a tag 'site' containing the same port as defined in project settings. If Visual Studio created some wrong site tags new, remove them. – salted Feb 07 '17 at 15:43
  • 1
    This worked for me. I just deleted the config file, restarted VS and rebuilt the solution. IIS generated the config correctly this time. – metabuddy Aug 06 '20 at 11:32
  • Worked for me. I had corrupted my config file – Jared Beach Oct 05 '20 at 15:25
56

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.

Buggieboy
  • 4,438
  • 4
  • 52
  • 79
Michael.
  • 944
  • 12
  • 16
  • 4
    In Windows 10 Anniversary edition it's called Mobile Hotspot and can be opened by typing e.g. "hotspot" in the Start menu and selecting Change mobile hotspot settings. – Mathias Rönnlund Oct 04 '16 at 13:13
  • 4
    As Michael told, the problem was ICS. But you don't need to disable the service, just restart it and the port will be free. – Daniel Genezini Oct 01 '18 at 11:00
  • 2
    damn! never thought sharing connection in win 10 could cause this issue. thanks man! – John Woo Jul 29 '20 at 07:05
  • 2
    @DanielGenezini Ah yes! Thanks that did it! Been struggling with this for too long – Applejag Nov 19 '20 at 07:54
  • 1
    How in tarnation did you figure this one out, @Michael.? This is one nasty bug. Thanks for sharing. – LargeDachshund Dec 07 '20 at 03:53
  • 1
    I couldn't stop this service but restarting it solved the issue. Thanks! – Mariusz Pawelski Feb 03 '21 at 09:28
  • @Michael. A thousand times, thank you! How did you determine that ICS was the root cause? – David Wilson May 13 '21 at 18:19
  • Thumbs up from me. This indeed was the problem. I did have to go through the Hotspot menu, since the 'services' menu did not allow me to kill the process (probably need to do that as Admin.) Still do not understand why the Hotspot feature is enabled by default. – Cees Meijer May 26 '21 at 14:55
  • This was the fix for me, just had to restart it. How in the world you figured this out is beyond me. – minimalist_zero Jun 23 '21 at 21:26
  • Just found the same process blocking my IISExpress startup, I found it with TCPViewer because it was using ports close to the one I was trying to bind. Looks like it locks up a whole range of ports... – Guillaume86 Dec 22 '21 at 13:23
  • I am using VS2022 and this answer helped me. Tried few other solutions but only this one worked. Quick and easy fix. – sanpat Feb 02 '22 at 17:29
50

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!

Philip Trenwith
  • 3,291
  • 1
  • 10
  • 10
  • 2
    Perfect Solution! I had docker installed which was causing the same problem. Thanks so much – Richa Garg Jan 07 '20 at 19:31
  • 4
    just the command to identify exclusion ports so they can pick a free port is the simple solution to the port_is_in_use problem. No need for messing with Hyper-V or whatever other service is using/reserving the ports (and my big thanks for you help) – HPWP7 Jan 11 '20 at 05:59
  • @HPWP7 Yes you are correct, the simple solution would be to pick another port. In my case I have to use port 50403 because the service gets consumed from external services which I have no control over. Therefore I need to reserve port 50403. (It is a pleasure, glad I could help) – Philip Trenwith Jan 13 '20 at 08:20
  • thank you! I spent an hour trying everything else without luck. – Max Favilli May 06 '20 at 23:08
  • Thank you! I was able to skip the uninstall/reinstall steps by just restarting the pc once and not starting any (docker) containers after boot, before having run the command from step 3. Luckily I only rebooted once, but that could just be luck. It might take a couple – Malte R Jun 10 '20 at 14:51
  • 1
    I did not get it. The port you are trying to use, you are adding to the exclusion list, how will that help? Does that not mean your added port to the exclusion list is not free anymore and you can't use it? I may be missing something. – ANewGuyInTown Jul 15 '20 at 08:20
  • 1
    @ANewGuyInTown that is a good question, I have not looked into it in much detail, hence my answer may not be correct, however, I believe the account used to add the port to the exclusion list owns the port, in my case, it is the same account that is used to run the application, hence the port is available for my application – Philip Trenwith Jul 27 '20 at 09:54
  • This worked for me looks like docker had been reserving the same port rider wanted – Ismail Jan 13 '21 at 09:21
  • Thank you @philip. I had to pick the port that's not in the tcp port exclusion ranges. – Mahesh Dec 01 '21 at 06:27
31

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.

Arjan
  • 15,041
  • 4
  • 29
  • 36
27

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.

ScaryLooking
  • 532
  • 3
  • 12
26

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=::
Sir CodesALot
  • 936
  • 1
  • 16
  • 16
  • 1
    @amy netsh configures Windows server roles/features. Essentially that enables http and ip listening for localhost. For those interested here's Microsoft's docs on it: https://technet.microsoft.com/en-us/library/cc725882(v=ws.10).aspx#BKMK_1 – Sir CodesALot Nov 02 '16 at 11:32
  • Cheers @Micah, since then I had to undo this as all my locally configured IIS sites stopped working.. :/ – army Nov 02 '16 at 16:22
  • 2
    Amendment: I just had to add 127.0.0.1 as an ip to listen on, all works now. Thanks for the solution again ;) – army Nov 02 '16 at 16:54
  • I don't know how but this helped me fix the error after several hours trying to fix it, thanks a lot! – Oscar Ortiz Jul 31 '20 at 04:22
  • Man you are a savior... you came as an angel and save my day. Thanks a lot...cheers – tanvir Sep 15 '21 at 11:39
19

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

Dimitri C.
  • 21,170
  • 20
  • 81
  • 100
  • 2
    As a small note - I tried every solution from here. I even tried shutting down and starting the PC again and it didn't work. Then a colleague suggested I actually use RESTART instead of SHUT DOWN and it worked. *Poker face* :| Using Visual Studio 2015 on WIndows 8.1 . This bug happens very often on various VS solutions I run locally. – Prisecaru Alin Apr 21 '17 at 14:59
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.

Sven Sönnichsen
  • 935
  • 1
  • 11
  • 18
  • 8
    Cleaning out the `applicationhost.config` file worked for me. I just deleted all of the `` entries in it. `C:\Users\\Documents\IISExpress\config\applicationhost.config` – Nick Albrecht Dec 11 '14 at 00:13
  • Yeah. This one worked for me in VS 2013. I cleared my website entry under `` and pressed `Ctrl+F5`. It says error unable to launch IIS Express. So, right click on the project, go to properties, under Web, next to project URL text box where `http://localhost:3758/` specified, click on "Create Virtual Directory". Now `Ctrl+F5` launched the site well. – Gopinath Feb 24 '18 at 04:17
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

Community
  • 1
  • 1
Ignas Vyšnia
  • 1,999
  • 1
  • 15
  • 16
  • Even if you change your project port you need to run `netsh http add iplisten ipaddress=::` thanks @Ignas – OldTrain Jul 20 '16 at 19:33
11

This is the only solution I found

net stop winnat

net start winnat

Thanks to Matt

TAHA SULTAN TEMURI
  • 3,146
  • 2
  • 31
  • 52
10

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

maxmantz
  • 592
  • 1
  • 8
  • 25
  • This is also the most likely cause if the URL it can't launch is a fake one you added into your hosts file – MrLore Jun 01 '16 at 14:22
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
    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. – Andy V Jun 03 '16 at 19:49
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.

meJustAndrew
  • 5,189
  • 6
  • 49
  • 69
4

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.

Marcus Höglund
  • 15,128
  • 9
  • 44
  • 66
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.

Matt Stannett
  • 2,632
  • 1
  • 11
  • 33
  • 2
    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. – tenderloin Apr 10 '17 at 04:22
  • 1
    I had to do this to set it to using ssl and then back to not (my app is not supposed to use ssl) – Rainhider Oct 26 '17 at 20:48
3

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

Closing it solved my problem.

Loris
  • 1,861
  • 3
  • 18
  • 26
  • This way is probably the best way, as it's not just desperately trying anyting to fix the problem, but instead helping to find the actual cause.In my case some other process sporadically picked the same port by chance that the IIS wanted to use, and this answer helped me to finally find the culprit. – causa prima Jun 14 '18 at 06:00
2

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

Abdisamad Khalif
  • 705
  • 1
  • 6
  • 19
2

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.

Damitha
  • 642
  • 5
  • 7
2

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.

Daniel Hilgarth
  • 166,158
  • 40
  • 312
  • 426
  • 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) – Technobabble Mar 23 '17 at 18:57
2

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.

hsobhy
  • 1,453
  • 2
  • 19
  • 35
2

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
live-love
  • 41,600
  • 19
  • 198
  • 177
2

I write it for information.

Delete the file in the project.

After Clean>Build>Proje Start

Oğuzhan Sari
  • 89
  • 1
  • 9
2

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.

k rey
  • 591
  • 3
  • 11
2

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.

workabyte
  • 3,350
  • 2
  • 25
  • 34
2

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
Morpheus
  • 495
  • 1
  • 9
  • 20
2

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.

Devator
  • 3,286
  • 4
  • 32
  • 52
2

For me, what solved it was disconnecting from the VPN (we're using FortiClient)

eddiewould
  • 1,488
  • 14
  • 34
1

Looks like everybody has own problem Just sharing what I did to fix this problem in VS2015 (Windows 8.1), my solution has 6 web sites (not web apps)

  1. Open your solution file *.sln
  2. Change in your solution file string VWDPort = "34781" (make it unique in your solution if you have more that 1 web site, I made +2) in notepad.

See sample solution file ProjectSection(WebsiteProperties):

Project("{E24C65DC-7377-472B-9ABA-BC803B73C61A}") = "BOSTONBEANCOFFEE.COM", "Source_WebOfficeV4\BOSTONBEANCOFFEE.COM", "{5106A8F5-401B-4907-981C-F37784DC4E9D}"
ProjectSection(WebsiteProperties) = preProject
    SccProjectName = ""$/PrismRMSystem/VS2012/WebOfficeV4.root/WebOfficeV4", IPYHAAAA"
    SccAuxPath = ""
    SccLocalPath = "..\.."
    SccProvider = "MSSCCI:Microsoft Visual SourceSafe"
    TargetFrameworkMoniker = ".NETFramework,Version%3Dv4.0"
    ProjectReferences = "{04e527c3-bac6-4082-9d39-aad8771b368e}|YBTools.dll;{5d52eaec-42fb-4313-83b8-69e2f55ebf14}|AuthorizeNet.dll;{d8408f53-8f1e-4a71-8b05-76023b09b716}|AuthorizeNet.Helpers.dll;{77ebd08a-de0f-4793-b436-fad6980863e6}|WEBCUSTCONTROLS.dll;"
    Debug.AspNetCompiler.VirtualPath = "/BOSTONBEANCOFFEE.COM"
    Debug.AspNetCompiler.PhysicalPath = "Source_WebOfficeV4\BOSTONBEANCOFFEE.COM\"
    Debug.AspNetCompiler.TargetPath = "PrecompiledWeb\BOSTONBEANCOFFEE.COM\"
    Debug.AspNetCompiler.Updateable = "true"
    Debug.AspNetCompiler.ForceOverwrite = "true"
    Debug.AspNetCompiler.KeyFile = "Key\StrongKey.snk"
    Debug.AspNetCompiler.DelaySign = "false"
    Debug.AspNetCompiler.AllowPartiallyTrustedCallers = "false"
    Debug.AspNetCompiler.FixedNames = "true"
    Debug.AspNetCompiler.Debug = "True"
    Release.AspNetCompiler.VirtualPath = "/BOSTONBEANCOFFEE.COM"
    Release.AspNetCompiler.PhysicalPath = "Source_WebOfficeV4\BOSTONBEANCOFFEE.COM\"
    Release.AspNetCompiler.TargetPath = "PrecompiledWeb\BOSTONBEANCOFFEE.COM\"
    Release.AspNetCompiler.Updateable = "true"
    Release.AspNetCompiler.ForceOverwrite = "true"
    Release.AspNetCompiler.KeyFile = "Key\StrongKey.snk"
    Release.AspNetCompiler.DelaySign = "false"
    Release.AspNetCompiler.AllowPartiallyTrustedCallers = "false"
    Release.AspNetCompiler.FixedNames = "true"
    Release.AspNetCompiler.Debug = "False"      
    VWDPort = "34781"
    SlnRelativePath = "Source_WebOfficeV4\BOSTONBEANCOFFEE.COM\"
EndProjectSection

In my case, I tried to change URL from project properties, restart VS, reboot computer, nothing helped me only this SLN file manipulation fixed my problem.

Eugene Bosikov
  • 820
  • 10
  • 12
1

For me this problem was entirely related to a broken install of Oracle ODP tools for VS. I uninstalled and reinstalled and everything was working again.

Worthy7
  • 1,307
  • 14
  • 27
1

And in my case, it turned out that I didn't have IIS enabled in Control Panel under Windows Features. Reference Image, since SO won't let me upload

WJK
  • 673
  • 2
  • 6
  • 20
1

In VS2017. I had to edit my .sln file and had to update the VWDPort = "5010" setting. None of the other solutions posted here worked.

Enkode
  • 4,164
  • 3
  • 32
  • 47
1

In my case, I had the setting Override application root URL checked, on the Properties->Web tab. I was using that previously when I was running VS as an administrator, but now that I'm running it in a non-admin account, it causes the error.

Sean
  • 13,396
  • 11
  • 70
  • 110
1

None of the above worked for me but the solution here https://forums.asp.net/t/1979442.aspx?Cannot+change+the+project+URL+in+project+properties did.

Once I had the solution file open in notepad I did a find and replace of the port that was causing the problem, saved it and reopened the solution in visual studio. The first time I picked a port number that was only 1 off from the one that was causing my problem and I still got the same error. When I changed to a port that something like 10,000 off it worked. I'm not sure if that makes a difference.

user2721607
  • 289
  • 3
  • 5
  • 1
    A link to a solution is welcome, but please ensure your answer is useful without it: [add context around the link](//meta.stackexchange.com/a/8259) so your fellow users will have some idea what it is and why it’s there, then quote the most relevant part of the page you're linking to in case the target page is unavailable. [Answers that are little more than a link may be deleted.](//stackoverflow.com/help/deleted-answers) – LW001 May 11 '18 at 21:26
  • 1
    You saved me here, changing port (51998) by a couple, a few times, all failed with same error, but changing to 22201 worked fine. I just used the project properties GUI – Tyeth Mar 15 '21 at 21:10
1

I also read the answers and comments and tried some solutions from this thread.

Then a Googled a little more and this worked for me

https://www.c-sharpcorner.com/blogs/iis-express-failed-to-register-url-access-is-denied

Didn't comment on no one's answer because I didn't read whats written here, so it needed a new answer post. There's answers here that talk about netsh wlan stuff, but I didn't see exactly this solution. If some one wrote the exact same solution please tell me so I can comment there and remove this.

1

I have the same with VS2019 occasionally.

The general problem is that the port is already taken or not usable, and there's a lot of possible reasons for that, resulting in lots of different answers here.

I want to add what helped me: The problem was just temporary and I tried again without changing anything and it just worked. So I just propose to test this first, because it is the easiest thing to do.

Eike
  • 955
  • 8
  • 11
1

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.

1

Folks, i read all the comments ranging between 2 page views and still none helped my situation. Although, some helped to a little extent. Finally this is what helped solved my situation and i assume it may be the case for someone else too.

I have a docker Desktop as well in my laptop and I was running some in Docker. Then, i opened my VS and wanted to debug my specific app. Although with VS 2019 and the web api is configured to use Https port, the http port was causing this issue. After attempting all the steps that were mentioned in the answers, i went with my gut

  1. to stop and kill my docker desktop app.
  2. Then stopped the running IIS Express.
  3. Just simply pressed F5 (to debug) and voila!

So, there are various reasons to this issue and it depends on individual's machine status and apps they have.

I tried deleting the .vs folder, removing the IISExpress folder in user profile's documents folder, but then, my Docker app I guess must be taking over the remaining IP addresses if my VS is not using them.

So, kindly check any other apps that may take/consume some span or range of IPs and try kill them. In my case, I started Docker again after running my VS and things are going as expected so far!

Ak777
  • 303
  • 7
  • 16
0

First of all, running VS as an Administrator solved the problem. But the weirdest part I already checked the "run as administrator" setting on the shortcut which seemed not working.

Looks like we need to explicitly click "run as administrator" choice from the shortcuts context menu

enter image description here

enter image description here

Ozan BAYRAM
  • 2,508
  • 1
  • 24
  • 29