可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
I receive this error when trying to launch IIS Express from Visual Studio with a project that's configured to listen to an address other than localhost. Visual Studio freezes for about 30 seconds before giving the error "Unable to launch the IIS Express Web server".
I've tried all the solutions posted to similar questions and I think I've done everything correctly. Here are the steps that I have taken:
Add the following reservation to HTTP.SYS:
netsh http add urlacl url=http://+:36899/ user=Everyone
Run Visual Studio 2012 as an administrator (technically I don't think I should even have to since I set up HTTP.SYS manually).
Disable Windows Firewall.
Delete my IISExpress folder in my My Documents folder to ensure the default settings.
Allow Visual Studio to create the entry in applicationhost.config for my web project. Then manually edit the config file to change localhost
to 192.168.0.100
which is my local IP. Then go back into the project properties in Visual Studio and change localhost to the IP and save the project so that my project is now set to http://192.168.0.100:36899
.
I also tried changing the port and repeating the above steps just incase the port was in use for some reason.
I want to make my IIS Express developer instance accessible from my IP on the Internet for remote testing.
回答1:
If using VS2015, close the solution, delete the following file, then re-open the solution.
<<path_to_solution_folder>>\.vs\config\applicationhost.config
note the .vs folder may be hidden
回答2:
The one thing that fixed this for me was using the following line in the <bindings>
section for my site in the applicationhost.config
file:
<bindings>
<binding protocol="http" bindingInformation="*:8099:" />
</bindings>
The key was to simply remove localhost. Don't replace it with an asterisk, don't replace it with an IP or a computer name. Just leave it blank after the colon.
After doing this, I don't need to run Visual Studio as administrator, and I can freely change the Project Url in the project properties to the local IP or computer name. I then set up port forwarding and it was accessible to the Internet.
EDIT:
I've discovered one more quirk that is important to getting IIS Express to properly serve external requests.
If you are running Visual Studio/IIS Express as an administrator, you must not add a reservation to HTTP.SYS using the "netsh http add urlacl ..." command. Doing so will cause an HTTP 503 Service Unavailable error. Delete any reservations you've made in the URLACL to fix this.
If you are not running Visual Studio/IIS Express as an administrator, you must add a reservation to the URLACL.
回答3:
I had exactly the same issue. Tried everything but finally one trick worked.
- Delete folder IISExpress from "My Documents"
- Load your project again, it will create IISExpress folder again with updated configuration
- Check IISExpress folder has sufficient permissions to read-write the configuration file
- Load project again and Run IISExpress. It should work.
回答4:
I was changing this entry (for which my web server was not running and showing me access denied error for a particular port)
<bindings>
<binding protocol="http" bindingInformation="*:61235:localhost" />
</bindings>
in the "applicationhost.config" in "Documents\IISExpress\config" for a particular webapplication it was overwritten by Visual Studio 2012 again to default port whenever I was starting my webapplication.
But I resolved the problem by doing nothing in the applicationhost.config
. I just changed the "project properties" > "web" > "project url" setting from http://localhost:62135/
to http://localhost:47279/
(depends on your computer) and it worked for me.
回答5:
- Close your project.
- Go to folder settings and select show hidden folders option.
- Open the folder where your application is. You will see a
.vs
folder.
- Open the
.vs
folder, you will see a config
folder in it. Delete its content.
- Run Visual Studio in admin mode. Open your solution from the
File
menu.
- Clean your solution.
- Build it.
- Run it and voila!
I do not recommend deleting IIS Express folder or messing with the config file in it.
回答6:
I had the same issue, but with a different cause that may help others.
Use a commandprompt in admin mode for this:
- TYPE: netsh http show iplisten
If there are any IP entries:
- TYPE: netsh http delete iplisten
Repeat until the list is empty. Check if IIS Express starts now.
Hope this helps,
Niels
回答7:
Deleting the unnecessary site entries from applicationhost.config file solved the issue for me.
回答8:
Try this:
- Open Properties of your solution
- Go to web
- under LOCAL IIS, Change written port number to any other port number and create a
new virtual directory.
回答9:
For me it was the applicationhost.config
file in .vs
folder in my project solution folder(.vs
folder is hidden by default).So,I closed the project and delete the .vs
folder (vs will recreate it again when you open the project) then reopen the project and run it.
回答10:
Simply start your Visual Studio as Run as Administrator
Thanks,
回答11:
In my case i tried following things to fix this problem.
Delete the iisexpress folder from "MyDocuments"
Go to Solution Explorer --> Right click on the Project --> Go to Properties --> Go to Web tab --> See the Servers --> click on radio button "USe Visual Studio Developtment Server"
I hope this will help you.
回答12:
I fixed it with the following steps:
- Close Visual Studio
- Run
netsh http show urlacl
and see if your application http address/port is listed.
- Run
netsh http delete urlacl url=[ADDRESS]
replacing [ADDRESS]
with the Reserved URL shown by the previous command. For example http://+:17560/
- Run VS again (as Admin) then go to web project's Properties -> Web then click on Create Virtual Directory button.
- Now you should be able to run the web project.
回答13:
I spent 1 hour trying every recipe mentioned above. Then out of no where I restarted my computer, and tried again. And everything is fine now.
So please try restarting your computer before trying all the above mentioned solutions. It might help
回答14:
I had the same problem with Visual Studio 2012. I managed to resolve it by removing from C:\Program Files (x86)\IIS Express\AppServer\applicationhost.config path unneccessary site entries. Alongwith running my VS2012 as an Administrator. Hope this helps
回答15:
At the start, Try to disable your firewall. It helped me. The Eset Smart Security 5 blocked it.
回答16:
I had this problem some days ago and all of above items could not help me.
I have ESET Smart Security 5.0 on my SONY VAIO laptop which works in interactive mode!
Finally I found the problem, ESET was blocking VS2012!
In the past, ESET had asked me to allow the VS2012 to communicate with Microsoft, I had chosen "Deny Access" and ESET had mad a rule for denying
VS2012. I omitted this rule from "ESET rules zone" and my issue was solved!
回答17:
Delete IISExpress folder in my My Documents folder to ensure the default settings or restore the same to previous version when it was working fine.
回答18:
Remove the default website from the <sites> </sites>
<site name="WebSite1" id="1" serverAutoStart="true">
<application path="/">
<virtualDirectory path="/" physicalPath="%IIS_SITES_HOME%\WebSite1" />
</application>
<bindings>
<binding protocol="http" bindingInformation=":8080:localhost" />
</bindings>
</site>
and your own <site> </site>
and run "C:\Program Files\IIS Express\iisexpress.exe"
http://www.iis.net/learn/extensions/using-iis-express/running-iis-express-from-the-command-line
回答19:
In VS 2013 I saw this error after setting up Google Docs synchronization on My Documents. Updated permissions to not be read-only and problem solved.
回答20:
In Debug > Website Properties.
change port number in Project Url to any nearest value and save
回答21:
open command prompt as administrator
then execute this command :
netsh http show urlacl
you will see the url you have added before
now you should execute this command :
netsh http delete urlacl url=http://+:36899/ user=Everyone
please check the url from list when using :
(netsh http show urlacl)
回答22:
I face this issue, All I did was go to the web project Properties -> Web -> In the ProjectUrl I clicked on the "Create Virtual Directory" and my issue was fixed.
回答23:
I had the same issue with my computer having loads of windows updates.
Spent few hours trying to resolve the issue using above answers with no luck.
In past we have different issues due to anti-virus which caused the application to be blocked by it, so thought to try by disabling it.