Reputation: 3570
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:
Deleted %userprofile%\Documents\IISExpress\
, tried to run.
netsh http add urlacl url=http://localhost:62940/ user=everyone
, rebooted and tried to run. (Actually user=Alla
since Swedish Windows).
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/" ...
.
Reinstalled IIS 8.0 Express
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.
Upvotes: 248
Views: 254599
Reputation: 3864
I tried all the answers above. It only worked when I stopped the Windows Service ICS (Internet Connection Sharing).
Upvotes: 1
Reputation: 2901
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
Upvotes: 0
Reputation: 5261
This is the only solution I found
net stop winnat
net start winnat
Upvotes: 167
Reputation: 1633
For me, what solved it was disconnecting from the VPN (we're using FortiClient)
Upvotes: 2
Reputation:
Yeah, I agree, top answers are really pro solutions. Here is one for intermediates:
Solution Explorer
<DevelopmentServerPort>0</DevelopmentServerPort>
<DevelopmentServerVPath>/</DevelopmentServerVPath>
<IISUrl>http://localhost:62940/</IISUrl>
Upvotes: 118
Reputation: 406
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
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!
Upvotes: 1
Reputation: 61
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.
Upvotes: 1
Reputation: 1321
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.
Upvotes: 1
Reputation: 83
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.
Upvotes: 1
Reputation: 3904
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.
Upvotes: 3
Reputation: 4391
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
netsh int ipv4 add excludedportrange protocol=tcp startport=50403 numberofports=1 store=persistent
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.
My application now worked perfectly!
Upvotes: 59
Reputation: 574
In Visual Studio 2019 Just remove Debug profile and create new one Do the Trick
Upvotes: 4
Reputation: 16846
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.
Upvotes: 8
Reputation: 3775
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.
Upvotes: 3
Reputation: 1992
Running netstat -abn
I noticed that the software "Duet Display" was reserving thousands of ports in the ~51000 range.
Closing it solved my problem.
Upvotes: 4
Reputation: 318
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.
Upvotes: 1
Reputation: 9472
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...
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
Upvotes: 66
Reputation: 15164
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.
Upvotes: 1
Reputation: 17054
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.
Upvotes: 34
Reputation: 631
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.
Upvotes: 3
Reputation: 4803
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.
Upvotes: 1
Reputation: 683
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
Upvotes: 1
Reputation: 9881
try (as elevated administrator)
netsh http delete urlacl url=http://*:62940/
Upvotes: 73
Reputation: 2728
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:
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.
Upvotes: 3
Reputation: 95
I write it for information.
Delete the file in the project.
After Clean>Build>Proje Start
Upvotes: 0
Reputation: 52444
In Visual Studio 2015:
Upvotes: 3
Reputation: 956
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=::
Upvotes: 26
Reputation: 1561
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.
Upvotes: 1
Reputation: 850
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)
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.
Upvotes: 1
Reputation: 1000
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.
Upvotes: 57