ChatGPT解决这个技术问题 Extra ChatGPT

Unable to launch the IIS Express Web server

I have an asp.net MVC 4 solution. When I try to open it using Visual studio 2012, I get following error:

Microsoft Visual Studio Configuring Web https://localhost: for ASP.NET 4.5 failed. You must manually configure this site for ASP.NET 4.5 in order for the site to run correctly. Could not find the server https://localhost:44300/ on the local machine. Make sure the local IIS server has been configured to support secure communications. OK Help

Although the solution opens. Also, When I try to run it from debug menu, I get following error:

 Unable to launch the IIS Express Web server.

The start URL specified is not valid. https://localhost:44300/

and I can not debug the code. how to get rid of these errors and debug/run the web site from VS 2012 ?

Please suggest.

The error messages are pretty clear on what's wrong: 1) You must manually configure this site for ASP.NET 4.5 in order for the site to run correctly. and 2) The start URL specified is not valid.. Also you seem to be using HTTPS; AFAIK IIS Express doesn't support that (and if it does you'll probably need to configure it, hence the Make sure the local IIS server has been configured to support secure communications part). Edit: It does seem to support SSL: riii.nl/apr5u, a step-by-step guide by Hanselman himself!
@Robel, I see that in properties of site, under application tab, target framework is 4.5, and in Web Tab, Start Action is Current Page. should I change project url to localhost:44300 ? I am using IIS express 8
It was the firewall setting :(
I was able to solve this issue by following way - 1) Visual Studio - Options - > Search - IIS 2)Check "Use the 64 bit version of IIS Express for web sites and projects".
I think this will help stackoverflow.com/a/54222339/2923956 .

Y
Yehuda Shapira

I had the exact same problem. The reason - bad IIS config file.

Try deleting the automatically-created IISExpress folder, which is usually located at %userprofile%/Documents, e.g. C:\Users\[you]\Documents\IISExpress.

Don't worry, VS should create it again - correctly, this time - once you run your solution again.

EDIT: Command line for deleting the folder:

rmdir /s /q "%userprofile%\Documents\IISExpress"

This worked for me. Even after uninstalling and reinstalling IIS Express 8, it kept the same config file so my issue persisted. I renamed the IISExpress folder to something else and a new folder was created with a clean version of the config file.
@CoreyOgburn Should be under Documents folder and IISExpress, (i.e. C:\Users\Corey\Documents\IISExpress\Config) and delete the config folder. I have same problem but this didn't fix it for me.
Thanks. Just don't forget to close then re-open VS for it to reconfigure the IIS Express.
@crokusek has the answer for VS2015 Update 3. Navigate to the ".vs\config" folder in the solution directory and delete the "applicationhost.config" file there.
Try to delete the .vs folder in project If someone still didn't work after doing it and restart the computer,
M
Mihail Shishkov

If using VS2015 or above

Make sure iisexpress process is not running.

Make sure no other process is using your desired port. You can do that by executing

netstat -a -b

in the console (as Administrator, type cmd in start menu, right click and choose 'Run as admiminstrator'). If you see an entry which state is ESTABLISHED or LISTENING it means that some other process is using this port. You'll need to terminate that process or change the port.

Then delete the following file

<<path_to_solution_folder>>\.vs\config\applicationhost.config

note the .vs folder may be hidden

then find <<project-name>>.csproj.user file, open it with text editor (notepad) and make sure IISUrl under WebProjectProperties is configured to <IISUrl>http://localhost:XXXXX/</IISUrl> where XXXXX is your desired port.

after doing this and trying to start the app you may get

HTTP Error 500.19 - Internal Server Error
The requested page cannot be accessed because the related configuration data for the page is invalid.

Then go to {Project Properties} -> Web and Press the "Create Virtual Directory" button

https://i.stack.imgur.com/BQNrn.png


This worked perfectly on VS2015. Issue occurred to be after creating a legacy web application project in .NET core solution.
This worked, .NET core tooling made a mess with IISE :/
I'm usually living in the OWIN/NancyFx world, so when I had to do a Web API project after a hiatus, I was puzzled, until I saw this answer. - good to know this factoid - thanks!!!
work on VS 2915 @mihail i didn't delete anything, just create virtual directory ... what does it need for ?
@AbdouTelb check this out iis.net/learn/get-started/planning-your-iis-architecture/… by deleting the .config file you basically ensure that the file will be recreated by vs and thus any problems associated with it (and there can be many) will disappear. This file is used by IIS Express the same way like IIS uses its own applicationhost.config file so it's the same like restore factory defaults. Create Virtual Directory alone is not sufficient to remove any problems that may hide in the file. In your case you just got lucky :)
H
Hp_issei

@roblll had it right. But for those of you who didn't want to dig for the answer, here it is:

Close Visual Studio (might not be necessary, but it won't hurt). Navigate to your Documents folder. This is where my IISExpress configuration directory was. In the config folder, there is a file called the application host. Open that. Search for the name of your project. It should have been added in there by Visual Studio when it bombed in your previous attempts. Note that there's a binding for HTTP with the port you intend to use for https. //Change this: //to this:

Keep in mind, Visual Studio might have supplied different ports than you expected. Just make sure that the ports in the binding correspond to what's in the Web tab of your project's properties.

http://www.hanselman.com/blog/WorkingWithSSLAtDevelopmentTimeIsEasierWithIISExpress.aspx


I was actually opening a project developed elsewhere, changing the protocol configuration for the project to https and reloading the project got rid of the error. Thanks @Jacob!
Only deleting the IISExpress folder didn't solve for me. After deleting, when I relaunched VS and opened this project, an error dialog appeared, which was solved only after doing this. That project I downloaded in asp.net's page, it was a sample project.
Btw, if you have both http and https bindings, make sure you're not using the same port number on both of them.
T
The Red Pea

I had the same problem but the solution that worked for me was different.

In VS2013 Opened Debug > {YourWebsiteName} Properties Select the "Web" tab. Under "Servers" I found "Override application root URL" was checked. I unchecked it and saved.

That was all I needed to get things running.


I recommend you try this solution first. Ticking the box with an invalid url will create the error mentioned in the question.
Using VS 2019, one of my sites that was using the "Override application root URL" was checked. " would not run, but others using the same pattern would run ok. Tried disabling that option, and trouble site started working.
s
sknight

Try following steps:

delete the IISExpress folder as @Yehuda Shapira said restart computer delete the .vs folder in project

Have a good luck!


1.Close Visual Studio 2.Delete .vs folder that's worked for me. If I delete the .vs dolder while VS is open. It does not work.
Deleting the .vs folder is the sole thing that worked for me. The .vs folder is located inside the project folder, but it is hidden by default.
m
mat

Same Problem, but needed to start VS2013 in Admin Mode.


Unfortunately this didn't help me.
However, why? It was working fine without going into the folder to run devenv.exe Run as Admin. Now I have to run devenv.exe as Administrator.
Maybe some update was installed with administrator rights and since then it wouldn't work without admin privileges anymore.
V
Vinu

I had the same issue and then I opened the task manager -> processes then killed the iisexpress.exe process. After that I tried to run the application and was able to run it successfully


A
Amir Chatrbahr

In my case the project was on network drive and deleting IIS Express folder didn't help as described in other answers. My workaround was copying the project to local drive and it worked!


s
splattne

I had the same problem, thanks to @Jacob for giving information about it.

The Reason is - wrong entry for your project in config file applicationhost located at

C:\Users\(yourusername)\Documents\IISExpress\config 

Close all Visual Studio solutions. Rename IISExpress folder to some IISExpress-Copy (instead of deleting you can have a copy of it) Now open VS again and build/debug the project, now you would see IISExpress folder created for you again with correct configuration.

It worked for me and hope it should work for you also.


I tried the steps outlined in the other answers but this is the one that worked for me. I had to rename the IISExpress folder. Deleting it did not work for me.
doesn't work for me. it all started when i messed with https
A
ArgisIsland

I had the same issue, the cause was that the flag "override application root URL" was set under Properties --> Web After I removed the flag, IIS Express was starting fine with the defined port.


c
charlesreid1

It seems you need to do some configuring as you seem to be using SSL; here's a step-by-step guide by Scott Hanselman himself.


@Roblll , I dont see Use IIS Express option when i right click on my MVC project in VS 2012, I saw that in VS 2010. I try to enable SSL for the solution in properties windows and It says property not valid. Moreever, In applicationhost.config file, I see multiple entries for my application like Webapplication(1), Webapplication(2), Webapplication(3)
I had the same problem and overcame it by running VS2012 as admin (stackoverflow.com/a/13682315). I'm not too happy about that solution but I couldn't find any others.
In my project I noticed same port number was used for SSL and non-SSL. So I fixed that and the error went away.
s
splattne

The only solution that worked for me was to create another test project. Then following the next steps:

Right click the project and go to Properties -> Web Under the project URL in the Use Local IIS Web Server section, copy the project URL(http:// localhost:59002/) - this is from the test project. Navigate to the project which is giving this error. Right click the project and go to Properties -> Web. Paste the project URL in the Use Local IIS Web Server section (URL copied from the test project). Close the test project and save. Delete the test project and run the project that gave the error. Works after that...

Maybe not the best way but it was the only way I could get this to work. I received this error message after I reloaded my laptop (hard drive crashed) and got all of my projects from the server of where they where hosted.


I don't really now what I did to my solution, but also this was the only way I could fixed it. I even tried messing with the netsh command, deleting the IISExpress folder, start VS in Admin Mode and nothing else worked. I don't know where else the url:port get's mapped but taking other's project URL seemed the only solution for me.
x
xameeramir

Sharing this for future readers. Manually creating a virtual directory worked for me.

Select project in solution explorer

Press Alt + Enter

Go to Web section

Click Create Virtual Directory


A
Ali Sadri

After Two Hour searching on web i found my solution as bellow steps - close visual studio - remove .vs folder of your project - open visual studio and rerun project

thats work for me have a good time


d
deerchao

In my case after I allowed external request to my IIS Express website and configured windows firewall to allow iisexpress.exe, I can't start it from within Visual Studio 2013. I can still start it with command line, and it serves local and external requests well.

C:\Program Files (x86)\IIS Express>iisexpress /site:MyWebSiteName

I tried to create a firewall rule to allow my port, after that VS worked.


S
Saroj

I had the same problem with VS 2013 and even after all possible tries it was not working.My problem was solved by:

- In control panel (Program and Features) I found that all of the IIS related features were unchecked.I finally checked all of those and restarted my system.
- Then I started my VS 2013 as administrator and thats it everything
   worked fine then.

At least you can give this a try since it worked for me.


x
xameeramir

I had the same problem, in my case I just cleaned and then rebuild my solution and it worked for me


W
Witcher

I had similar issue - VS couldn't load particular web project because of that error. Here is what helped:

Edit project in solution

Look for UseIISExpress and/or UseIIS sections and make sure that they don't intersect with each other.

In my case it was like this:

...
<UseIISExpress>True</UseIISExpress>
...
<UseIIS>True</UseIIS>
...

So, I've changed this to:

...
<UseIISExpress>True</UseIISExpress>
...
<UseIIS>False</UseIIS>
...

and then it worked.


wowwwwww. This fixed in issue I've been working on for over 2 days. THANK YOU! What's odd in my circumstance is that every single project (75+) that this user has changed both settings to "true". I'm wondering how that happened - and also, is there a way to programatically change all projects? Or is there a visual studio setting that got messed up?
D
DMur

Close all instances of Visual Studio. Open Task Manager. End all active IIS processes. Restart Visual Studio.


J
JimmyV

We had the same issue with our sites. We were able to fix this all inside of Visual Studio. We are using 2012 Ultimate.

The underlying issue we saw was that with SSL enabled, for some reason, VS was assigning the same port for the standard and secure URLs. This issue seemed to arise when we were pulling the code down from TFS.

To remedy it, we undertook the following steps:

Right click the project and go to Properties -> Web Under the project URL in the Use Local IIS Web Server section, remove the "s" from the URL and Save. (EG. go from https://:44301 to http://:44301. This will allow the next step to work) In Solution Explorer, select the Project and in the Properties window (press F4 if not displayed) change SSL Enabled to False then back to True. It will generate a new port that is different from the standard URL (In my case, I have 44301 as my SSL and 44305 as my standard) Navigate back to Properties -> Web and add the "s" back to the project URL. F5 and ride!

Make sure that the check box for Override application root URL is unchecked.


A
Amit Joki

check the antivirus firewall and allow access visual studio to network. for example in nod32:

goto setting (f5) -> network->personal firewall->rules and zones

in the "zone and rule editor" click "setup" and find the vs 2010 or 12 or ... and allow access to network.


l
luk2302

After disabling the firewall I was able to run it without any issues.


f
fefferoni

I ran in to this error today. Running Win 8.1 and VS 2013. Suddenly my projects could not run anymore and i got the message "Unable to launch the IIS Express Web server" and no further information.

After a while I found out that all the projects that the IIS Express could not start all were running .net 3.5. Projects running later versions did start ok.

The solution for me was to remove .net 3.5 (from control panel -> turn windows features on/off), restart windows and the add .net 3.5 again.


G
Giles Roberts

I'd set up Internet Connection Sharing on my machine for virtual machines. I switched it off and I was able to debug in Visual Studio 2015. However to consistently debug following a reboot, I needed to set the Internet Connection Sharing service to manual start up, even though none of my internet connections had Internet Connection Sharing enabled.


A
Anshuman Jasrotia

Well none of the above mentioned steps worked for me. In my case my applicationhost.config file was somehow missing the following two line of code

 <add name="rules-64-ISAPI-2.0" path="*.rules" verb="*" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v2.0.50727\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv2.0,bitness64" />
    <add name="xoml-64-ISAPI-2.0" path="*.xoml" verb="*" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v2.0.50727\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv2.0,bitness64" />

Hope this can help some one.


D
Debashish Saha

Along with the answer given by @Yehuda Shapira I had to make another change which is Delete the .csproj.user file where the binding information like

<IISUrl>http://localhost:54462/</IISUrl>

is stored.Delete that File Close visual Studio and then rebuild.Hope this helps.


S
Stefanos Zilellis

Before you try anything else, make sure you 1. restart visual studio (mostly for refreshing memory resident options from files) and 2. restart your system (mostly for invalid file locking). If your problem is such temporary or self-fixed those will do without changing anything. It worked for me with PC restart. Also if you work on a multi-user project make sure you have the latest workable version - someone else may had check in something invalid by mistake at e.g. the project file and you mess with your system for no reason. If those won't work, then you probably need to alter some setting(s) that are stuck, missing or need modification - there are plenty propositions on other answers.


A
Ali Sadri

in my case I added new site binding on applicationHost.config file after delete that binding it work correct. the applicationHost.config path is in youre project root directory on .VS(hidden) folder


Tried to use applicationUrl of LAN (192.168...) some days ago. Later i changed all urls in .json file, but still was receiving error on IIS Express start from VS. In applicationHost.config i found with mentioned url, and removing it solved the problem.
S
Scott Decker

I had a similar problem when running my solution from VS2012:

Unable to launch the IIS Express Web server.  
The start URL specified is not valid. https://localhost:44301/

I had the incorrect project selected as Startup Project. I made the Cloud project the Startup (right click on project -> Set as Startup Project) and everything started working fine.


Should also add that the startup URL would need to be set, or set to "Current Page" or "Specific Page" -- at least checked. Mine was set to "Don't open a page. Wait for a request from an external application" and I had this error as a result, in addition to the startup project issue.
@Moumit did you down vote this? Can you explain your comment?
u
user1161391

Jason's Shavers series of articles here http://jasonrshaver.com/?tag=/Client+Certificates explain exactly how to set up your applicationhost.config site entry to allow the app to run in either ssl or standard http.

One of the things he recommends is putting two binding entries for the site. This is what I did.

            <bindings>
                <binding protocol="http" bindingInformation="*:59945:localhost" />
                <binding protocol="https" bindingInformation="*:44300:localhost"/>
            </bindings>

He also recommends changing other settings as well. It worked on two of my three machines. Each time I am told to manually configure a site in the application host it usually has to do with the bindings. (example using same port for multiple web apps.)