What I\'m doing:
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.
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
}
Try using a different port. I just set up a new Core 1.0 RC1 project and got the same error.
Worked for me (TM).
Answer from: https://stackoverflow.com/a/28650554/134761
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.
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.
Just close the visual studio and reopen and execute. It worked for me.