327
votes

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.


30
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!RobIII
@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 8DotnetSparrow
It was the firewall setting :(Moumit
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".RedBottleSanitizer

30 Answers

404
votes

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"
242
votes

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 for example 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

enter image description here

85
votes

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

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

    //Change this:
    <binding protocol="http" bindingInformation="*:44300:localhost" />
    
    //to this:
    <binding protocol="https" bindingInformation="*:44300:localhost" />
    

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

41
votes

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

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

That was all I needed to get things running.

21
votes

Try following steps:

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

Have a good luck!

16
votes

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

15
votes

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

14
votes

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!

12
votes

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 
  1. Close all Visual Studio solutions.
  2. Rename IISExpress folder to some IISExpress-Copy (instead of deleting you can have a copy of it)
  3. 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.

9
votes

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.

8
votes

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.

6
votes

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

  1. Right click the project and go to Properties -> Web

  2. 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.

  3. Navigate to the project which is giving this error. Right click the project and go to Properties -> Web.

  4. Paste the project URL in the Use Local IIS Web Server section (URL copied from the test project). Close the test project and save.

  5. 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.

5
votes

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
4
votes

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.

3
votes

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.

3
votes

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

3
votes

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

2
votes

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:

  1. Right click the project and go to Properties -> Web
  2. 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)
  3. 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)
  4. Navigate back to Properties -> Web and add the "s" back to the project URL.
  5. F5 and ride!

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

2
votes

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.

2
votes

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

2
votes

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.

2
votes

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.

2
votes

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.

2
votes

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.

2
votes

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.

2
votes
  1. Close all instances of Visual Studio.
  2. Open Task Manager.
  3. End all active IIS processes.
  4. Restart Visual Studio.
1
votes

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.

1
votes

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.)

1
votes

I had the same problem after installing Visual Studio 2013 Update 3.
VS 2013 can not load Microsoft.VisualStudio.TraceLogPackage.dll
Unable to launch the IIS Express Web server

My problem solved by doing the following steps :

1. Repair Visual Studio 2013 Update 3
2. Start the Developer Command Prompt as administrator.
3. Type devenv.exe /setup then press enter

1
votes

I had the same issue. I had deleted a lot of folders under C:/users/ path to free some space on my machine. After which I started getting this error.

I just had to restart my machine and it all worked fine.