58

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:

  1. Add the following reservation to HTTP.SYS:

    netsh http add urlacl url=http://+:36899/ user=Everyone

  2. Run Visual Studio 2012 as an administrator (technically I don't think I should even have to since I set up HTTP.SYS manually).

  3. Disable Windows Firewall.

  4. Delete my IISExpress folder in my My Documents folder to ensure the default settings.

  5. 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.

Trevor Elliott
  • 11,292
  • 11
  • 63
  • 102

27 Answers27

63

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

Ibrahim Dauda
  • 645
  • 8
  • 19
Hemant Jain
  • 631
  • 5
  • 4
51

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.

  1. 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.

  2. If you are not running Visual Studio/IIS Express as an administrator, you must add a reservation to the URLACL.

Trevor Elliott
  • 11,292
  • 11
  • 63
  • 102
  • 3
    Great tip! In my case, this helped too: http://blogs.msdn.com/b/finbar_ryan/archive/2013/01/02/debugging-the-unable-to-launch-the-iis-express-web-server-error-from-visual-studio-2012.aspx – deerchao Dec 21 '13 at 13:27
  • Worked for me, but only after I restarted Visual Studio too. – Richard Fawcett Mar 07 '14 at 10:55
  • 3
    Trevor you saved my life. I was close to quit programming and become a farmer. Took me so long to get this fixed but the "just blank after colon" trick saved me. Anyway one more thing, for me i still needed to add the URLACL reservation, since otherwise I would get "Failed to register URL "http://*:62940/" for site "SITE NAME" application "/". Error description: Access is denied. (0x80070005)." Needed to add exactly that to ACL list. Thank's god it works now. – skhro87 Sep 19 '14 at 07:24
  • 2
    When you change this for IIS Express you need to run visual studio in Admin mode. if not, IIS Express won't start up. – Stefanvds Jul 25 '15 at 03:38
  • This works but fails when my project URL is pointing to a different hostname other than localhost when loading the project. I made some instructions here to achieve https://gist.github.com/sydcanem/30c16b414bc47694d2ce. – James Jan 16 '16 at 06:12
  • Can anyone direct me to instructions on how to find out what i recently added using the NetSh command, i we reading other SO posts and several has me run netsh commands and I cant' find the links. I'm now only able to run non admin in vs2019 Thanks – Eric Brown - Cal Oct 01 '20 at 18:40
31

I had exactly the same issue. Tried everything but finally one trick worked.

  1. Delete folder IISExpress from "My Documents"
  2. Load your project again, it will create IISExpress folder again with updated configuration
  3. Check IISExpress folder has sufficient permissions to read-write the configuration file
  4. Load project again and Run IISExpress. It should work.
Sumit Bajaj
  • 327
  • 3
  • 3
  • This worked for me! My "My Document" dir is on our fileshare, so when I switched from an old PC to a new one, my VS projects loaded just fine, but got the generic "Unable to launch the IIS Express Web server" error when I tried to run the app. Deleting and re-running the project fixed the issue for me. – ewitkows Jan 20 '15 at 16:04
  • Didn't have exact same error but IIS related functionality (creating a new MVC project, launching a web site, and so on) kept giving errors . I had an IISExpress folder under Documents from a previous system installation with both VS and WebMatrix installed. Deleting the entire folder seems to have fixed all my issues. VS created a fresh new IISExpress folder. – Protongun Jan 27 '15 at 07:40
  • Not for me. So far only solution is to reboot the machine. – Patrick Borkowicz Jan 21 '16 at 20:04
  • VS2013, same issue. Just the step#1 solved it for me! – Vin May 11 '17 at 17:18
  • Thanks. Only this fix resolved my issue. Buggy Microsoft as usual filled with undeserved people in their core. – vibs2006 Sep 20 '22 at 08:55
  • Thanks buddy. This worked for me finally after struggling for almost 2hrs. Make sure to take a back up of IISExpress folder for safety. – Shantilal Suthar Jan 31 '23 at 11:51
14
  1. Close your project.
  2. Go to folder settings and select show hidden folders option.
  3. Open the folder where your application is. You will see a .vs folder.
  4. Open the .vs folder, you will see a config folder in it. Delete its content.
  5. Run Visual Studio in admin mode. Open your solution from the File menu.
  6. Clean your solution.
  7. Build it.
  8. Run it and voila!

I do not recommend deleting IIS Express folder or messing with the config file in it.

apollo
  • 408
  • 3
  • 10
10

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.

Blair
  • 15,356
  • 7
  • 46
  • 56
Arpan
  • 101
  • 1
  • 2
7

Try this:

  1. Open Properties of your solution
  2. Go to web
  3. under LOCAL IIS, Change written port number to any other port number and create a new virtual directory.
Bahtiyar Özdere
  • 1,818
  • 17
  • 21
Raja
  • 451
  • 5
  • 5
  • This did the trick for me! Modifying/deleting applicationhost.config did not work, but a simple change of the port did. Note: I only experienced the problem when running "Start without debugging (CTRL+F5). – Lars Peter Larsen Jun 09 '20 at 07:53
6

Simply start your Visual Studio as Run as Administrator

Thanks,

Nimesh
  • 3,342
  • 1
  • 28
  • 35
5

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

Niels Bos
  • 61
  • 1
  • 1
  • I been struggling with this for 15 hours. finally this solved my issue. thank you very much!!!!! – NAS Mar 19 '17 at 04:31
5

Deleting the unnecessary site entries from applicationhost.config file solved the issue for me.

Kira
  • 1,153
  • 4
  • 28
  • 63
user3310307
  • 51
  • 1
  • 1
4

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.

fbarikzehy
  • 4,885
  • 2
  • 33
  • 39
2

In my case i tried following things to fix this problem.

  1. Delete the iisexpress folder from "MyDocuments"

  2. 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.

Mario Levrero
  • 3,345
  • 4
  • 26
  • 57
Sunny
  • 2,183
  • 1
  • 17
  • 13
2

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.
orad
  • 15,272
  • 23
  • 77
  • 113
1

In Debug > Website Properties.

change port number in Project Url to any nearest value and save

enter image description here

user3501613
  • 596
  • 7
  • 28
1

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

0

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

Nav
  • 1
  • 1
0

At the start, Try to disable your firewall. It helped me. The Eset Smart Security 5 blocked it.

0

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!

Babak
  • 1
0

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.

Elvis
  • 29
  • 6
0

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

Sushil
  • 2,837
  • 4
  • 21
  • 29
IonB
  • 11
  • 6
0

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.

Rick Putnam
  • 546
  • 1
  • 6
  • 20
0

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)

Arash.Zandi
  • 1,010
  • 2
  • 13
  • 24
0

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.

Willy
  • 3,506
  • 3
  • 22
  • 35
0

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.

Hille
  • 2,123
  • 22
  • 39
varun
  • 54
  • 1
  • 7
0

So after trying all the solution, I just uninstall "One Drive" from my PC & the problem is resolved.

N.B:

  • I was trying to run .net core web application.
  • Visual Studio 2017 version 15.9.5
  • Windows 10 Pro, 64 bit
Biswajit Panday
  • 817
  • 10
  • 20
0

Click the Solution and press F4. Then match the port from Right-click on solution and select Properties to the web tab port. The port no will be the same of both case F4 and Properties.

Abhishek Kanrar
  • 418
  • 4
  • 6
0

Tried deleting IISExpress folder, changed port , restart VS and PC but it didn't work. However it worked after killing iisexpress.exe service in services.

0

change the parameter in the registry

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\HTTP

parameter Start from 4 to 3 and reboot

Grigory Zhadko
  • 1,484
  • 1
  • 19
  • 33