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:
This question is related to
c#
asp.net
asp.net-mvc
visual-studio-2015
I'm using VS2017, I Disable Tool > Options > Debugging > Enable JavaScript debugging for ASP.NET
then work.
I think the underlying issue is permission for me
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.
Just run the visual studio as administrator and that's it.
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
I added .UseUrls("https://localhost:<some port>/")
to the Program.cs. This seemed to do the trick for me!
Try this first if it was working and suddenly stopped:
Change port manually for http and https (or disable https)
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 :
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)
Then I've changed port 80 from http binding to (whatever you like) 8081 as below:
So after that all projects(web page, apis) started working correctly.
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:
Other Solutions:
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.
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.
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!
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.
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.
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
It was not apparent that the file was corrupt or incorrect or even when it changed to cause failure.
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.
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
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.
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.
delete bin and obj folders from the project folder and rebuild.
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.
I just Cleaned my solution, Then Re-Built it and finally hit F5 and it worked! So simple.
I have solved it in a very simple way.
By the following:
Hope this helps you. :"))
With the Visual Studio closed, I deleted the temporary folder iisexpress
in: C:\Users\<your_user>\AppData\Local\Temp\iisexpress
.
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:
YourSolutionFolder\\.vs\config\applicationhost.config
file (note: .vs is a hidden folder)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.
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).
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.
For me it was very easy.
I just encountered the same problem and I killed all the "iisexpress.exe" processes that were still running. That worked for me!
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.
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.
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.
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.
Just change all port numbers to new of any working series.. . Don't change application host .config ...
I didn't figure out what was causing the issue. But a repair install fixed it.
First: remove .vs
folder from project (aside .sln
file), then open project.
Good luck
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
.
I repaired Visual Studio 2017 installation and it worked again
Exit VS and delete the (project)\.vs\applicationhost.config
file. Restart VS. It should start working.
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).
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
}
Mine happens as soon as I add a new binding inside the applicationhost.config, running as administrator fixed the problem.
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!
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.
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.
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
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:
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:
The issue may be because [v] 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.
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.
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
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:
Copy those commands and run them in cmd with ADMIN privileges and with YOUR ip address and port number.
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.
I simply toggled on "Enable SSL". This solved my problem.
Just close the visual studio and reopen and execute. It worked for me.
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
Restart your computer, that will work, at least it did it for me.
Source: Stackoverflow.com