352

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
13

73 Answers 73

434

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.

21
  • 16
    For me it was .vs\config\<MyProject>\config\applicationhost.config Apr 17, 2019 at 12:11
  • 2
    where do you see web site that you need to right click on? May 9, 2019 at 14:57
  • 244
    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. Apr 23, 2020 at 13:23
  • 21
    Thank you @QuintonSmith. Your solution worked for me in .NET Core 3.1 as well. Aug 4, 2020 at 7:45
  • 17
    Anyone using @QuintonSmith's approach of deleting the launchSettings.json it's located under the <project>/Properties folder. Took me a minute to find exactly where it was located but it did the trick!
    – vandsh
    May 17, 2021 at 21:53
289

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

14
  • 25
    This worked for me in VS2017, without having to change the port.
    – mlienau
    Jul 12, 2017 at 14:49
  • 4
    After doing this for me was needed run Visual Studio as Administrator, and worked, thanks! Jul 29, 2017 at 0:38
  • 6
    Especially the RUN AS ADMINISTRATOR is important for me. (although I have Asp.net Core 2.0 VS2017. Feb 10, 2018 at 18:00
  • 7
    Deleted the whole .vs folder and worked for me, just that Jul 14, 2018 at 13:56
  • 16
    Restarting VS2017 didn't fix but restarting the computer fixed it for me. Didn't need to change the port or delete the folder. Hope it helps others.
    – Tonmoy
    Jul 17, 2018 at 21:13
53

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

4
50

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)
10
  • I was able to do this by shutting down only Visual Studio, deleting the .vs folder, stating Visual Studio again. Jun 14, 2019 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, 2019 at 20:18
  • 7
    Got this after a bluescreen. Had to delete .vs folder and restart the computer. Restarting visual studio was not enough.
    – sevenam
    Oct 10, 2019 at 12:07
  • 3
    My steps were compressed to: 1) Clean Solution. 2) Exit Visual Studio. 3) delete .vs folder
    – samneric
    May 3, 2020 at 17:56
  • 1
    @samneric Thanks for that, i'll add you solution to the answer :)
    – Daniaal
    May 4, 2020 at 9:45
41

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.

3
  • 3
    this worked for me, was an easy solution -- thanks Dec 25, 2020 at 18:35
  • Only other thing that worked for my .NET Core 3 project besides rebooting the computer.
    – John81
    Jun 29, 2021 at 15:38
  • This is the one that worked for me, the others did not work.
    – Cobysan
    Dec 12, 2022 at 19:59
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.
1
  • The solution worked. Thanks :) How about DELETE the .git folder as well?
    – krunal.cp
    May 18, 2020 at 15:44
23

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

2
  • 2
    You are not a start, but a superstar! Thanks it worked Aug 28, 2020 at 9:24
  • Doesn't work for me.
    – Reven
    Nov 9, 2021 at 8:38
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.

1
  • 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, 2022 at 9: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

2
  • 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, 2019 at 11:21
  • 2
    After three days of plucking hair, this solution helped me. Thank you
    – Meir
    May 1, 2019 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).

1
  • 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, 2018 at 21:07
13

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.

1
  • It doesn't matter if the IP already is in use if the ports are different. Aug 2, 2022 at 7:21
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.

1
  • This was the solution for me, Thanks Feb 17, 2020 at 18:15
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!

0
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 🤯.

2
  • I did all the complicated answers (and some worked) but just restarting the computer did the trick :)
    – Poat
    Jul 27, 2021 at 15:05
  • agreed. tried everything before restart. but restart is the only thing that worked.
    – mfreedm52
    May 18, 2022 at 15:01
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.

2
  • I had to do this to increment the port number. my original post was 'stuck' and I don't have time now to reboot or figure out how to fix it Nov 10, 2016 at 22:01
  • 1
    to highlight the change: http instead of https
    – Alex P.
    Aug 25, 2020 at 12:22
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.

6

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

2
  • 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 Feb 19, 2020 at 21:15
  • Worked for me, given I didn't really do any changes before that
    – mgPePe
    Oct 13, 2021 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.

5

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

0
5

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

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.

1
  • 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. Jan 27, 2019 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.

2
  • 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, 2020 at 12:46
  • After trying a whole bunch of things. This solved my issue. Thank you @Jason J. Lee Feb 8, 2021 at 18:07
3

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

3

Try this first if it was working and suddenly stopped:

  • Close Visual Studio
  • Kill iisexpress.exe processes
  • Reopen Visual Studio
3

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

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
}
1
  • When launchSettings.json is automatically generated or updated by VS, the applicationUrl should have / in the end. More info can be found in blog.lextudio.com/…
    – Lex Li
    Mar 30, 2018 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.

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.

3

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.