346

What I'm doing:

Deleting applicationhost.config, located in Documents\IISExpress\config, doesn't change the error message. (There's also an IISExpress folder in program files and program files (x86).)

Something I noticed, and I don't know if it's a problem:

Referenced file 'lib/jquery-validation/jquery.validate.js' not found.

I got a dump with rawcap but I don't notice much in there. Some of what was there:

"Framework":{"FrameworkName":"DNXCore,Version=v5.0","FriendlyName":"DNX Core 5.0","ShortName":"dnxcore50","RedistListPath":null}

I don't notice a problem, but I have the network data if that can help figure out why I cannot connect to the web server. I get a RST,ACK immediately so I'm guessing the port is closed and whatever this web server is, isn't being setup.

More on this problem: 800700c1 error from /trace:error

I've tried:

  • deleting applicationhost.config (and changing port number)
  • running visual studio as administrator
  • deleting IISExpress folder in Documents (changes error message until the folder is reinstalled)
  • toggling ssl off and on, copying url to launch box. (note: I'm not using ssl)
  • clearing all sfc /scannow errors
  • starting iisexpress with x86 version and 64-bit version
Community
  • 1
  • 1
Sarek
  • 3,518
  • 2
  • 10
  • 9
  • 2
    Does this help? http://stackoverflow.com/questions/15873126/unable-to-launch-the-iis-express-web-server. Or changing the port? http://stackoverflow.com/questions/23502327/unable-to-launch-the-iis-express-web-server-failed-to-register-url-access-is-d – mariocatch Feb 27 '16 at 22:17
  • 4
    try when you open visual studio right click and open as administrator.. – Hazem Torab Feb 27 '16 at 22:30
  • I'm trying all suggestions people give me even if I have tried before. – Sarek Feb 27 '16 at 22:33
  • can you open new project an check if this is working? Restart PC? Move project to other directory – Sebastian 506563 Feb 27 '16 at 23:12
  • 1
    Thank you but that also didn't work. – Sarek Feb 28 '16 at 01:03
  • @Sarek, were you able to find a solution? If so, do you mind answering your own question? We are having the same issue. – Andrei Apr 06 '16 at 15:45
  • I tried everything and cleared everything up with sfc /scannow. Then I gave up and just did a repair install. That worked, but I have no idea what the problem was. – Sarek Apr 22 '16 at 01:36
  • @Sarek In my case just closing and re-opening the VS2015-Update3 worked. I'm using ASP.NET core 1.1. Maybe, with new version, steps I took was good enough to resolve the issue or different users have different solutions depending on their VS configurations etc. – nam Jan 12 '17 at 15:33
  • ASP.NET Core in Visual Studio 2015 is not considered as a fully supported scenario, so such issues are expected. All users should migrate to Visual Studio 2017, or switch to Visual Studio Code. – Lex Li Mar 30 '18 at 21:15
  • 3
    This happens to be every once an a while after changing absolutely nothing. The issue has been around for awhile and MSFT still hasn't worked it out. Hate them for it and their support sucks. Screw them. – Lamar Aug 10 '18 at 15:15
  • 1
    this article solved my issue -> http://overengineer.net/fixing-unable-to-connect-to-web-server-iis-express – JGilmartin May 07 '19 at 09:06
  • Close Visual studio. Try to delete Bin, Obj and vs folder. After that problem should resolve, It worked for me. – Mahmut EFE Sep 20 '20 at 19:15
  • Last time restarting worked. This time, it didn't. Deleted project, re-pulled. Didn't help. Delete project, re-pulled, restarted. Works. Not sure, but not worth spending more time on. – VSO Apr 23 '21 at 15:39

71 Answers71

429

After installing Update 2 for Visual Studio 2015 I started getting the same error. I tried everything above with no luck. However, I found a solution that works for me:

  1. Delete YourSolutionFolder\\.vs\config\applicationhost.config file (note: .vs is a hidden folder)
  2. Open Visual Studio, right-click on web site > Properties > Debug tab > Web Server Settings > App URL - change port number.

If you have IIS configured to use the same port, (stop the application / use different port) and try again.

Community
  • 1
  • 1
Victor Stagurov
  • 4,566
  • 1
  • 15
  • 15
  • Man, my error came back, found this as well on another site, but it just keeps giving the damned error. Pissing me off. I'd run the web console, but that doesn't have a watcher, so that I can just ctrl + s, refresh. – René Sackers Apr 24 '16 at 17:48
  • Omg, it works. I deleted the IISExpress folder in my documents, then I deleted that file, then I started getting this error, but the accepted answer was the solution: http://stackoverflow.com/questions/33166403/an-error-occurred-attempting-to-determine-the-process-id-of-the-dnx-process-host and now it's working :| – René Sackers Apr 24 '16 at 17:54
  • Just installed Update 3, started getting this error after adding a new class to a Core project. This solution worked for me. – Michael Jan 12 '17 at 16:12
  • Changing the port number is annoying af when you have saved testing requests – Lamar Aug 10 '18 at 15:27
  • 16
    For me it was `.vs\config\\config\applicationhost.config` – laggingreflex Apr 17 '19 at 12:11
  • 2
    where do you see `web site` that you need to right click on? – CodyBugstein May 09 '19 at 14:57
  • VS 2019 - .vs\config\\config\applicationhost.config worked for me, too. – Dan Orlovsky Aug 04 '19 at 22:06
  • Changing the port number did the job for me – Matt Searles Feb 07 '20 at 00:48
  • 240
    For Net Core 2.2 project - After a MASSIVE struggle and trying everything from deleting .vs folder, deleting IIS Express configs, changing port numbers, changing bindings, and to running VS as admin I FINALLY fixed issue by 1. closing VS, 2. deleting `launchSettings.json` 3. opening VS which re-generated `launchSettings.json`. It was not apparent that the file was corrupt or incorrect or even when it changed to cause failure. – Quinton Smith Apr 23 '20 at 13:23
  • 21
    Thank you @QuintonSmith. Your solution worked for me in .NET Core 3.1 as well. – Anand Murali Aug 04 '20 at 07:45
  • 2
    Thanks @QuintonSmith, your solution is working in Visual Studio 2019 Preview for ASP.NET Core 5 (.NET 5 RC2 SDK) as well. – Sk Shahnawaz-ul Haque Nov 03 '20 at 13:11
  • keep in mind with will delete all the previous setting like swagger or docker so just make a copy of the old one @QuintonSmith. – Abdullah Tahan Nov 18 '20 at 16:12
  • Worked for me in VS 2019 with a .NET Core 5 project. The file path was slightly different: `.vs\\config\applicationhost.config` – burgoyne Nov 18 '20 at 18:17
  • 1
    @QuintonSmith Thank you again. Deleting launch settings fixed it for me, whereas the other solutions did not. Whew! – Azoreo Nov 24 '20 at 22:30
  • @QuintonSmith Can you please make an official answer? I keep having to dig to find this when it happens every few months. – rory.ap Dec 21 '20 at 14:45
  • @rory.ap - As requested - https://stackoverflow.com/a/65421182/4977243 – Quinton Smith Dec 23 '20 at 08:30
  • This is work around not a solution. In team development you can't change the debug port at your will. – WSK Mar 10 '21 at 23:24
  • 17
    Anyone using @QuintonSmith's approach of deleting the `launchSettings.json` it's located under the `/Properties` folder. Took me a minute to find exactly where it was located but it did the trick! – vandsh May 17 '21 at 21:53
  • None of this is working for me. VS2019 .NET Core 5.0 – Faizan Mubasher Aug 22 '21 at 04:45
  • Try restarting the computer, as a last resort. If Quinton's workaround does not help. – Chris W Jan 18 '22 at 22:21
  • Similarly for me, after trying all of the other steps (port, del .vs folder, reboots) I deleted launchSettings and back working. Strange thing is, just deleting .vs folder has worked when I encountered this previously. Not this time. – obaylis Jan 20 '22 at 08:13
287

Exit VS and delete the (project)\.vs\applicationhost.config file. Restart VS. It should start working.

dwoodard
  • 3,069
  • 1
  • 11
  • 5
52

Try using a different port. I just set up a new Core 1.0 RC1 project and got the same error.

  • Right click web project
  • Debug tab
  • Toggle Enable SSL off and on again, it should generate a new random port
  • Copy the SSL URL and paste into Launch URL box
  • Run the project

Worked for me (TM).

Answer from: https://stackoverflow.com/a/28650554/134761

enter image description here

Community
  • 1
  • 1
angularsen
  • 8,160
  • 1
  • 69
  • 83
  • 1
    It worked but only when i used port 60000 . port 6000 returned error : unsafe port. – EKanadily Feb 03 '17 at 18:35
  • 3
    Didn't work in Visual Studio 2019 - it just used the same port each time. – EJoshuaS - Stand with Ukraine Mar 24 '20 at 13:12
  • @EJoshuaS-ReinstateMonica I believe this has changed a lot. Take a look at how your `Startup` class is configured and what `appsettings.json` files you have. There is also `Properties\launchSettings.json` to launch different profiles locally. https://learn.microsoft.com/en-us/aspnet/core/fundamentals/environments?view=aspnetcore-3.1 https://dejanstojanovic.net/aspnet/2018/december/setting-up-kestrel-port-in-configuration-file-in-aspnet-core/ – angularsen Mar 25 '20 at 08:55
  • 1
    Thanks buddy you helped me alot, I have been trying to fix this stupid error :) – Alexander Zaldostanov Mar 28 '21 at 04:18
49

I had this issue on .net core 2.1, visual studio version 15.9.6. When i deleted the .vs folder, i reopened visual studio and the problem was still there. The solution that worked for me below:

  1. Delete .vs folder (it is a hidden folder).
  2. Restart Computer.

Other Solutions:

  • Close Visual Studio, delete bin and obj folders from the project folder. Open Project then rebuild solution.
  • Try running Visual Studio as Administrator.
  • Clean Solution then rebuild
    1. Clean Solution. 2) Exit Visual Studio. 3) delete .vs folder 4) Re-open Visual Studio
  • Restart machine (if you can afford to)
Daniaal
  • 882
  • 8
  • 16
  • I was able to do this by shutting down only Visual Studio, deleting the .vs folder, stating Visual Studio again. – Robert Bratton Jun 14 '19 at 19:46
  • Yeah it works for some not in my case though. No idea why it didn't work. The only thing that did was restarting my computer. – Daniaal Jun 16 '19 at 20:18
  • It works but no need to restart computer.Only close the Visual Studio. Delete the .vs folder and again start the visual studio. I am using visual studio community 2019 – Sonali Jul 12 '19 at 04:43
  • Ah ok, glad it worked. Mine was weird cause when i opened the message, it would still not work and after restarted it worked. Must be a lock and configuration gone wrong in a file in the vs folder. – Daniaal Jul 12 '19 at 10:00
  • 7
    Got this after a bluescreen. Had to delete .vs folder and restart the **computer**. Restarting visual studio was not enough. – sevenam Oct 10 '19 at 12:07
  • Glad it worked for you! Never happened to me since but there may have been a fix. I'm now running the latest version of Visual Studio. – Daniaal Oct 10 '19 at 12:15
  • @SarahLissachell Amazed me too! Took me hours to figure it out so i am glad it helped :) – Daniaal Jan 25 '20 at 12:17
  • 3
    My steps were compressed to: 1) Clean Solution. 2) Exit Visual Studio. 3) delete .vs folder – samneric May 03 '20 at 17:56
  • 1
    @samneric Thanks for that, i'll add you solution to the answer :) – Daniaal May 04 '20 at 09:45
  • actually, it worked once then the issue came back lol. My situation ended up being caused by Docker. This ended up being the ultimate solution... https://stackoverflow.com/a/61579820/558509 – samneric May 04 '20 at 20:39
40

Copied my comment to an answer by request.

For Net Core 2.2 project - After a MASSIVE struggle and trying everything from deleting .vs folder, deleting IIS Express configs, changing port numbers, changing bindings, and to running VS as admin I FINALLY fixed issue by

  1. closing VS,
  2. deleting launchSettings.json
  3. opening VS which re-generated launchSettings.json.

It was not apparent that the file was corrupt or incorrect or even when it changed to cause failure.

Quinton Smith
  • 2,550
  • 18
  • 17
29

I faced this issue in .net core 2.0 when I update my project's port number.

I was able to sort out issue in two steps :

  • STEP 1 : DELETE .vs folder which is hidden inside main solution folder. (close visual studio before this) then when you start again visual studio, this folder and file (applicationhost.config) inside it will automatically create by visual studio.
  • STEP 2 : For multiple startup projects, if you are still facing issue then one by one run project as startup, and then run as multiple startup project.
Saurin Vala
  • 1,898
  • 1
  • 17
  • 23
22

I had the same issue, i was able to solve it by changing the Port number.

  1. Right click on the project and select properties

  2. Go to the Debug section

  3. Under Web Server Settings change App URL port [just increase by one :)]

enter image description here

Akbar Badhusha
  • 2,415
  • 18
  • 30
16

In my case that was some other application listening on the same port which IIS Express trying to attach to. I have to run netstat -ao to see PID of process which is use same port and shutdown application. In my case application was Viber.

codevision
  • 5,165
  • 38
  • 50
  • In my case it was OneDrive. Restarting that made it change ports and then I was able to run my application. – Simon C Jan 19 '22 at 09:55
16

I just changed my profile from "IIS Express" to "MyProjectName" (which I think is using kestrel as the http server instead of IIS) and now it's working fine:

enter image description here

tedi
  • 6,350
  • 5
  • 52
  • 67
  • 3
    This is not a solution, but a workaround. Your answer suggest using different server - Kestrel - while OP clearly is trying to get IIS-Express to work. – Prolog Feb 19 '19 at 11:21
  • 2
    After three days of plucking hair, this solution helped me. Thank you – Meir May 01 '19 at 16:03
13

Run VisualStudio with administrator privilegies and run the project. Then close VisualStudio and all errors and run VisualStudio again with the normal user.

This did it for me.

Looks like that IIS has to write something to some config with admin privilegies (port 80 didn't work with normal user but port 6767 worked fine).

Tadej
  • 553
  • 7
  • 16
  • 5
    Only administrator permissions allow the application to bind to a port number smaller than 1024. That's why 6767 works for you. – Lex Li Mar 30 '18 at 21:07
13

Many of these answered don't fully address the issue at hand. The real problem for me was that I had two bindings using the same port in my applicationhost.config file AND I hadn't opened up the port to my second (non localhost) binding. VS will allow you to still run under these circumstances but only if you are in admin mode (hence all of the answers above).

You are essentially creating two IIS express instances of your app on the same port, so changing one of the ports in your applicationhost.config file will allow you to proceed. There are two different applicationhost.config files however. You will want to select the one that has the binding IP and port that you see in your project's properties

enter image description here.

Go to the folder where you can see your project solution and project folders (show hidden items in File Explorer). Navigate into your hidden .vs folder -> "YourAppName" folder -> config. It should contain the binding info you saw in your project's properties.

Example:

<bindings>
    <binding protocol="http" bindingInformation="*:7000:127.0.0.1" />
    <binding protocol="http" bindingInformation="*:7000:192.168.0.5" />
</bindings>

Change one of those port numbers to something other than "7000" so that you aren't trying to use the same port.

In my case, I'm using a 192 address which is not a localhost address, so I need to use some netsh commands to open that port and ip up. Here is a Link that shows how to open up ports for IIS Express to allow remote connection. Running as a normal user will not work unless you run those netsh commands listed.

Here are the netsh commands:

  1. netsh http add urlacl url=http://192.168.1.42:58938/ user=everyone
  2. netsh advfirewall firewall add rule name="IISExpressWeb" dir=in protocol=tcp localport=58938 profile=private remoteip=localsubnet action=allow

Copy those commands and run them in cmd with ADMIN privileges and with YOUR ip address and port number.

MedievalCoder
  • 627
  • 7
  • 10
12

TO CLARIFY

Really a lot of answers here are the same and say something like "Restart and it magically works again".

Well, 9 out of 10 times people have this issue like the OP it is because THE IP-ADDRESS IS ALREADY IN USE.

ANSWER

There could be 2 ip-addresses that are in use. Both of them you can find by:

1) Right-clicking on the start-up project

2) Click on "Properties"

3) Click on the "Debug" tab

Here you see your "App URL" and your "SSL URL".

  • If your "App URL" is in use, just change it there and save it and it should work again.

  • If your "SSL URL" is in use, close down VS, delete the "applicationhost.config" file in the hidden .vs folder of your project and open VS up again.

Svenmarim
  • 3,633
  • 5
  • 24
  • 56
10

The solution that worked for me was to: Close the VS project In File Explorer, navigate to the project and delete the entire ".vs" folder Restart the project Run as "Debug" Works Apparently, it has something to do with the "applicationhost.config" file.

Enjoy!

Amit Kumar Verma
  • 357
  • 1
  • 3
  • 15
9

If you can afford to restart your machine then do it , this fixed my issue after almost an hour of trying to fix this issue with no hope .

Benzara Tahar
  • 2,058
  • 1
  • 17
  • 21
6

I was able to toggle this error by changing a single thing. In my ASP.Net Core 1.0 RC2 Web Application project's launchSettings.json file:

  "iisSettings": {
    "windowsAuthentication": false,
    "anonymousAuthentication": true,
    "iisExpress": {
      "applicationUrl": "https://localhost:18177/",
      "sslPort": 0
    }
  },

to

  "iisSettings": {
    "windowsAuthentication": false,
    "anonymousAuthentication": true,
    "iisExpress": {
      "applicationUrl": "http://localhost:18177/",
      "sslPort": 0
    }
  },

I had changed to https in an attempt to run the project using that protocol. Apparently this is not the place to make that change. I suspect it is creating multiple bindings on the same port, and IIS Express doesn't like that.

redwards510
  • 1,802
  • 1
  • 17
  • 23
6

I had this same issue, but the way I fixed it was by going to the applicationhost.config and remove a port which was not added by me (IIS Express I would guess) which placed my specific port site on another port.

Here is what the config file had for my bindings:

<bindings>
      <binding protocol="http" bindingInformation="*:54764:localhost" />
      <binding protocol="https" bindingInformation="*:44360:localhost" />
</bindings>

I removed the first bindings item as the only port I wanted was 44360. My config file now looks like this:

<bindings>
      <binding protocol="https" bindingInformation="*:44360:localhost" />
</bindings>

Now I don't see the error when I debug.

I also noticed my second API in my project had port 80 also assigned to it, I removed that as well.

Jeff
  • 134
  • 1
  • 5
6

delete bin and obj folders from the project folder and rebuild.

Muhannad
  • 467
  • 4
  • 28
  • Although a manual clean often times does help, it won't resolve the issue in this case as the problem resides in the applicationhost.config file and is most likely caused by trying to use the same ip address twice – MedievalCoder Feb 19 '20 at 21:15
  • Worked for me, given I didn't really do any changes before that – mgPePe Oct 13 '21 at 16:51
5

For me the problem was that an other process was using the same port. (In my case it was outlook that was using the same port as my site and thus my site couldn't start)

Yes you can change the local port, but if you are running an API or something that other applications need, you don't always want to do this.

To get a list of what applications are using what port open CMD and type "netstat -aon" You will get a list of ports. Find the port that your site should use, or that you want to use and write down / remember the PID.

Now open task manager and click on the tab 'details'. Find the process with your PID and end it. Now you should be able to start IIS Express with that port.

Enrico
  • 2,734
  • 1
  • 27
  • 40
5

I just Cleaned my solution, Then Re-Built it and finally hit F5 and it worked! So simple.

Rohan Rao
  • 2,505
  • 3
  • 19
  • 39
4

I won't pretend to fully understand what MS bug creates this problem, but here is another potential solution:

In the .vs/config/applicationHost.config file, find the section for <system.applicationHost><applicationPools>. Under the pools, ensure that the managedRuntimeVersion attribute value matches the value which is in the IIS config for the system (and/or the version of the .NET framework which is installed).

For example, you may find (as I did) that the generated file has:

    <add name="Clr4IntegratedAppPool" managedRuntimeVersion="v4.0" managedPipelineMode="Integrated" CLRConfigFile="%IIS_USER_HOME%\config\aspnet.config" autoStart="true" />

In my case, you would replace this with:

    <add name="Clr4IntegratedAppPool" managedRuntimeVersion="v4.0.30319" managedPipelineMode="Integrated" CLRConfigFile="%IIS_USER_HOME%\config\aspnet.config" autoStart="true" />

Note the replacement from "v4.0" to "v4.0.30319". This resolved the issue.


What appears to be going on:

I believe that VS is generating an applicationHost.config file with "default" versions for the .NET framework, which may not match the specific version which is installed/configured on the system. You can debug/observe this issue by tracing the execution in Process Monitor, and finding the command line for iisexpress.exe. Running this command with /trace:error added yields a more informative message about a failure to preload the CLR with version v4.0. To wit:

Starting IIS Express ...
Failed while trying to preload CLR version v4.0. hr = 80131700
Failed to initalize the W3WP_HOST hr = 80131700
Process Model Shutdown called
Unable to start iisexpress.


Anyway, figured this might be helpful to someone else, since it's common enough to have multiple references online with bad information, and I've personally hit it a few times now.

Nick
  • 6,808
  • 1
  • 22
  • 34
  • Non of these solutions worked for me, If you have installed default Windows IIS (Which comes with your windows) and have access to it, try to use it, that solved my problem, simply Add new website or new application there and it's done, anyway it's weird that IIS Express is unable to open up the page. If you need to trace it, just attach it to a process using `ctrl + alt + p` short keys and check `Show process for all users` and select `w3wp.exe` (sometimes need to refresh the website to find `w3wp.exe`) and then hit the `Attach` button. – Muhammad Musavi Jan 27 '19 at 16:04
4

For me, IIS Express was not accessible when I added iplisten on DOS Prompt like this: netsh http add iplisten MyIPAddress. I fixed it by deleting the iplisten like this: netsh http delete iplisten MyIPAddress.

Prolog
  • 2,698
  • 1
  • 18
  • 31
  • I subscribe: after playing with netsh configuration trying to make the server accessible from outside I encountered this problem. Forgot what I did and tried almost all the other answers until deleting the `iplisten` entry as described here. It seems like IISExpress has no error message in such a case. – Alex P. Aug 25 '20 at 12:46
  • After trying a whole bunch of things. This solved my issue. Thank you @Jason J. Lee – viniciusalvess Feb 08 '21 at 18:07
4

If you are using VS 2017 or VS 2019 with ASP.Net Core, you can directly go to launchSettings.json under Properties folder and just change the Port number of applicationUrl key for iisSetting.

enter image description here

Harsh
  • 123
  • 5
3

I just encountered the same problem and I killed all the "iisexpress.exe" processes that were still running. That worked for me!

poveilleux
  • 143
  • 1
  • 5
3

Try this first if it was working and suddenly stopped:

  • Close Visual Studio
  • Kill iisexpress.exe processes
  • Reopen Visual Studio
Simon_Weaver
  • 140,023
  • 84
  • 646
  • 689
3

Mine happens as soon as I add a new binding inside the applicationhost.config, running as administrator fixed the problem.

goamn
  • 1,939
  • 2
  • 23
  • 39
3

I added .UseUrls("https://localhost:<some port>/") to the Program.cs. This seemed to do the trick for me!

AFatBunny
  • 71
  • 1
  • 12
Post Impatica
  • 14,999
  • 9
  • 67
  • 78
3

Just close the visual studio and reopen and execute. It worked for me.

3

My solution (for .net core 2.0) was that i had forgot to add the port number in the applicationUrl, under iisExpress in launchSettings.json

"iisExpress": {
  "applicationUrl": "https://localhost:50770",
  "sslPort": 50770
}
Numm3n
  • 1,021
  • 2
  • 9
  • 26
  • When `launchSettings.json` is automatically generated or updated by VS, the `applicationUrl` should have `/` in the end. More info can be found in https://blog.lextudio.com/what-should-you-check-when-visual-studio-cannot-debug-asp-net-core-projects-4b5db8c5e129 – Lex Li Mar 30 '18 at 21:06
3

I was able to resolve this by restarting my computer. I tried a few things unsuccessfully and finally gave up and restarted my computer. It has been working well now for a couple of days after I restarted. Probably the result of some process that was hung.

Keenan Stewart
  • 594
  • 6
  • 9
3

For me, it was a mixture of following these instructions:

Delete your web application’s .vs\applicationhost.config and try again.

And then, perhaps most importantly, running Visual Studio with admin privileges.

contactmatt
  • 18,116
  • 40
  • 128
  • 186
3

The issue may be because [√] Enabled SSL was selected for your project (see the Debug tab in the project settings window), but Visual Studio decides to be dumb and setup something like http://localhost:32396. The reason it fails is because 1. it is not HTTPS, and 2. the cert is not valid. To force it, you need to use a port in the range 44300-44398.

See https://stackoverflow.com/a/24957146/1236397

James Wilkins
  • 6,836
  • 3
  • 48
  • 73
3
  1. Sign in as Administrator on local machine
  2. Open visual studio As Administrator
  3. Delete bin folders and .vs in project folder
  4. Delete all files in {users}\Documents\IISExpress

I think the underlying issue is permission for me

Francois Taljaard
  • 1,339
  • 2
  • 12
  • 33
2

I simply toggled on "Enable SSL". This solved my problem.

  1. Right click web project
  2. Debug tab
  3. Toggle Enable SSL "on" (if it is off, which was my case)
2

For me, I had to kill "NET Core Host" in my background processes.

Task Manager > Background Processes > Net Core Host > End Task

Then restarting the debug instance worked again as normal.

Boyardee
  • 304
  • 1
  • 6
2

I have solved it in a very simple way.

By the following:

  1. Turn off Microsoft Visual Studio.
  2. Reopen it with "Run as administrator"

Hope this helps you. :"))

Vương Hữu Thiện
  • 1,460
  • 14
  • 21
2

First: remove .vs folder from project (aside .sln file), then open project.

Good luck

Mojtaba Nava
  • 858
  • 7
  • 17
1

I didn't figure out what was causing the issue. But a repair install fixed it.

Sarek
  • 3,518
  • 2
  • 10
  • 9
1

Try in cmd

taskkill /im iisexpress.exe /f
taskkill /im dotnet.exe /f

and press f5. I do not change ports, delete files or reboot VS.

D. Nikitin
  • 61
  • 5
  • May be explain you answer a bit. Just killing the process might not be the answer here. And what after? – Shiham May 16 '17 at 07:15
1

Just run the visual studio as administrator and that's it.

Abdul Rauf
  • 23
  • 1
  • 4
1

And yet another way to get the same error:

Using 0.0.0.0 as the IP address. That works fine in production, but has started failing on IIS Express for us. Changing that back to localhost in dev, solved our issue.

Johny Skovdal
  • 2,038
  • 1
  • 20
  • 36
1

If you have read till this point, then probably, none of the answers above worked for you or suites you.

My solution to this problem is to shut down your computer, making sure to have saved all necessary open documents. Reboot your computer, Run Visual Studio and then you are good to go.

Chidi-Nwaneto
  • 634
  • 7
  • 11
1

if you copy the project from other pc. you can try

netsh interface ipv4 show excludedportrange protocol=tcp

to check the Start Port to End Port that is allowed to use on you computer

enter image description here

Pal
  • 23
  • 5
  • netsh interface ipv4 show excludedportrange protocol=tcp Worked for me, the port was within one of these ranges, I moved it outside the range and it worked – Sandwich Feb 10 '23 at 13:39
1

In my case (using ASP.NET Core 3.1 and Visual Studio Professional 2019), I've seen this twice and in both cases fixing it was as simple as rebooting my PC.

I strongly suspect, but can't prove, that this could also be accomplished by restarting only a specific process (like in @Codenova's answer).

  • Using the same software as you. I've done reboot, deleting vs folder, deleting bin/obj, start as admin, change the ports, reinstall IIS Express, and nothing has fixed this. It seems to kick off a refresh IIS Express instance every time I start the debugger then forgets itself. – dxk3355 Mar 24 '20 at 20:27
  • Seems to happen randomly for me. Only a reboot fixes it. In the case of ASP.NET Core projects I usually just run the project without IIS Express, which is the green drop down arrow next to the 'play' button in VS, switch to . As far as I know this is the same as running dotnet build and dotnet run from the command line. – Patrick Borkowicz Jun 13 '20 at 03:33
1

With the Visual Studio closed, I deleted the temporary folder iisexpress in: C:\Users\<your_user>\AppData\Local\Temp\iisexpress.

Eduardo Pelais
  • 1,627
  • 15
  • 21
1

in my case it was pulse secure vpn tripping up Visual Studio 2019 community edition for some reason ! workaround is to suspend vpn, start debug solution, then resume vpn connection.

ManiVI
  • 556
  • 1
  • 5
  • 18
1

Restart your computer, that will work, at least it did it for me.

Dayán Ruiz
  • 611
  • 1
  • 9
  • 22
1

Instead of debugging with the IIS Express profile, I recommend debugging with the profile named after your project. It works fine for me. I'm never going back to IIS Express!

Joe Eng
  • 1,072
  • 2
  • 15
  • 30
1

Depending on what caused the issue the solution may be far more simple than those proposed above. I have seen this fault arise when I renamed my project directory or a folder within which it is contained. Renaming the folder structure back to what it was solves the error for me. Ofcourse this isn't the perfect solution in the event you would genuinely like to change the folder structure.

Dean P
  • 1,841
  • 23
  • 23
0

For the following, enter image description here All I had to do was navigate to the current project solution directory > .vs > config to delete applicationhost.config, then restart VS and run as usual without problem.

.vs is a hidden folder

AjCodez
  • 360
  • 3
  • 10
0

I repaired Visual Studio 2017 installation and it worked again

Braytiner
  • 470
  • 4
  • 12
0

I'm using VS2017, I Disable Tool > Options > Debugging > Enable JavaScript debugging for ASP.NET then work.

yu yang Jian
  • 6,680
  • 7
  • 55
  • 80
0

Windows 10 Defender Firewall was blocking it. I turned it off, ran the mvc core 2.0 application, and it worked. I then turned windows firewall on again and it remained working. All the other solutions although well intended didn't work for me. Hope this helps someone out there.

0

Make sure the following registry key \HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\HTTP\Parameters\ListenOnlyList does not contain IP addresses that are not bound to an enabled network adapter on your machine.

This was the cause of my issue after attempting the various other solutions listed in this SO question and many others, such as:

  1. Deleting applicationhost.config
  2. Toggling SSL on and off.
  3. Changing Port number.
  4. Manually killing IIS Express process.
  5. Reinstalling IIS Express.
  6. Repairing Visual Studio.
  7. Installing a new version of Visual Studio
  8. Creating a new .Net Framework Web Application.
  9. Creating a new .Net Core Web Application.
  10. Running netsh urlacl commands
  11. Running netsh http add iplisten ipaddress=::
  12. Running Visual Studio as an administrator.
  13. Assuring bypass traversal rights where applied..

Apparently, when IIS express was attempting to start it was trying to bind to this invalid IP. The fix was to delete the invalid IP. This additional invalid possibly came from my home wireless network while at work I am assigned a different IP via the hard wired adapter.

A catch-all solution may be to delete all IPs out of the registry key and run netsh http add iplisten ipaddress=:: to allow listening on all addresses.

I was able to track this issue down after noticing the following event log entries:

  • IIS Express: The worker process for app pool 'WebApplicationNetCore AppPool', PID='23260', failed to initialize the http.sys communication when asked to start processing http requests and therefore will be considered ill by W3SVC and terminated. The data field contains the error number.
  • IIS Express: The worker process failed to initialize correctly and therefore could not be started. The data is the error.
  • HTTP Event: Unable to bind to the underlying transport for 192.168.1.42:52999. 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.
Alexander Higgins
  • 6,765
  • 1
  • 23
  • 41
0

Just change all port numbers to new of any working series.. . Don't change application host .config ...

  • 1
    This is a bit unclear, what do you mean by "just change all port numbers to new of any work8ng series"? Can you provide more detail as to how this answers the OP or which parts of the OP it answers? Do you have a working example you can post? – GMc May 09 '19 at 12:53
  • I mean , change project deployment ports , for example local host:55314 like that ... Generally default is 44304 like , so change that ... Then all starts working. – Madhusudhan V Indian May 11 '19 at 03:23
0

In my case, I had to open up

Documents\IISExpress\config

folder and rename or delete existing config files. After this step, I ran the application and IISExpress generated new config files and the error was gone.

nPcomp
  • 8,637
  • 2
  • 54
  • 49
0

For those who still experiencing the problem. I had the same issue but the message was showing IIS only not IIS Express. Try to start VS as administrator. That solved the issue for me.

naslami
  • 345
  • 2
  • 4
  • 12
0

For me, this started happening on a project that was working, but then one day I got this error. I tried all suggestions around the .vs folder, applicationhost.config file, changing ports, restarting VS, rebooting Windows, reinstalling IIS Express. Nothing worked. I even created a new bare-bones web app, and got the same error. I have a feeling the IT department made some kind of change to my system.

After I try to run the project and IIS Express has started, in my elevated cmd prompt I run netstat -ano |find "44312" where 44312 is the port number of my web application. I noticed what's returned is not the usual localhost IP (127.0.0.1). It was some external IP. It tells me IIS Express using a different IP.

Then I ran netsh http show iplisten and I see that same IP in the results. netsh http delete iplisten [external ip], and BOOM! the web app loads!

nthpixel
  • 3,041
  • 3
  • 30
  • 42
0

In my case this error was caused because I was running Docker.

Make sure the port you are trying to host on is not in a Port Exclusion Range by running the following command in cmd/powershell session:

netsh interface ipv4 show excludedportrange protocol=tcp

I tracked this down after reading through this stackoverflow question:

Unable to launch the IIS Express Web server, Failed to register URL, Access is denied

Steve

samneric
  • 3,038
  • 2
  • 28
  • 31
0

If you don't want to reboot your can, a solution is to manually attach the debugger. In my case the application is launched but visual studio fails to connect to the iis. In Visual Studio 2019: Debug -> Attach to process -> filter by iis and select iisexpress.exe

Mikael Holmberg
  • 101
  • 1
  • 3
0

Faced the issue when reinstalled Windows on C: Drive, but my Visual Studio projects were intact on E: drive after the installation. I have resolved the issue by removing .vs folder in the visual studio project folder.

Kanna Reddy
  • 309
  • 4
  • 5
0

For me it was very easy.

  1. Clean the solution
  2. Re-build the solution.
  3. Run it Ctrl + F5 (Run without Debugging)
Rohan Rao
  • 2,505
  • 3
  • 19
  • 39
0

As Svenmarim already stated, this mostly occurs because the ip adress is already in use. This answer and its comments from the visualstudio developer community pointed me to the right direction. In my case i was trying to access my local IISExpress instance from my local network and therefore binded my ip adress with the same port which uses my IISExpress instance via
netsh http add urlacl url=http://192.168.1.42:58938/ user=everyone
After removing this binding via
netsh http delete urlacl url=http://192.168.1.42:58938/
it worked again.

Syles
  • 135
  • 11
0

I've tried all listed here, but nothing really helped. Solution was simply to change IIS server port listening (apparantely port 80 was already taken, but the error message didn't said so).

Btw. in my case port 80 was taken by main windows service which I couldn't stop/kill...

From main ISS manager, go to Default Web Site and edit bindings (below screenshot is in Polish - hope it helps anyway)

Edit IIS bindings

Then I've changed port 80 from http binding to (whatever you like) 8081 as below:

Change Http port to whatever you like

So after that all projects(web page, apis) started working correctly.

Qjot
  • 11
  • 2
0

Change port manually for http and https (or disable https)

Horev Ivan
  • 270
  • 3
  • 9
0

I was trying to launch the app on the URL "http://192.168.0.1:4000/", and the above answers didn't help. Finally, I added the *:4000:localhost HTTP binding to the .vs/.../applicationhost.config, so now the binding section looks like this:

<bindings>
  <binding protocol="http" bindingInformation="*:4000:localhost" />
  <binding protocol="http" bindingInformation="*:4000:192.168.0.1" />
</bindings>

And it did the trick

Kangaxx
  • 61
  • 5
0

My issue was similar to what others have said, but a slightly different flavor that may help someone. I am running VS 2019 and .NET 5.0 ASP.NET.

TL;DR

Ensure socket bindings in .vs\...\applicationhost.config and launchSettings.json for the project and selected configuration the match the current enabled NICs :).


Details

I had been mucking with my .vs\...\applicationhost.config and launchSettings.json to be able to host not just on localhost, but on my NICs IP address/port (socket) for testing on another device. Recently, I added a second socket to have a colleague test something over a VPN. When the VPN was not connected, I could not start IIS.

I reconnected the VPN, and everything started working again. Then after disconnecting the VPN, I updated launchSettings.json (and restarting VS2019), but forgot to update the bindings in applicationhost.config. I believe IIS Express still worked hosting one more time, but the 2nd time it would not. It was then that I realized I still had the VPN socket in the applicationhost.config bindings. I updated it, restarted VS2019 and all was well.

pigeon
  • 151
  • 9
0

Ending the IIS worker process in the task manager helped me solve this issue.

StarLord
  • 707
  • 1
  • 8
  • 21
0

I disabled the SSL in debug properties and then enable it again. It worked like charm.

If you can afford to restart your system, do it.

Prince
  • 103
  • 1
  • 6
0

-> close visual studio -> delete .vs file -> delete launchsettings.json

restart visual studio...

hope that solves your problem

0

If you made it this far, you are clearly desperate. Good luck to you and your pursuit to find happiness again.

Did you just merge code in from another branch? Did you accidentally merge in duplicate entries in the Program.cs file? (I'm using .NET Core 6)

For me, there were duplicate entries for both:

builder.Services.AddDatabaseDeveloperPageExceptionFilter();

and

builder.Services.AddDefaultIdentity...

Not sure which one caused the issue but fixing the merge resolved the problem.

Gabe
  • 837
  • 9
  • 13
0

Something that worked for me based on this

Make sure iplisten is configured to 0.0.0.0

If the IP listen list is not configured, this issue may occur (caution, I have no idea why).

Check netsh to ensure there is an entry for 0.0.0.0 In command prompt type:

netsh http show iplisten

There should be:

enter image description here

If it does not appear on your prompt, add the correct correct netsh rule. You'll need an admin cmd.exe or admin PowerShell for this.

In command prompt type: netsh http add iplisten ipaddress=0.0.0.0

General Grievance
  • 4,555
  • 31
  • 31
  • 45
MaciejW
  • 21
  • 3