356

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.

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 cannot debug the code. how to get rid of these errors and debug/run the web site from VS 2012?

TylerH
  • 20,799
  • 66
  • 75
  • 101
DotnetSparrow
  • 27,428
  • 62
  • 183
  • 316
  • 4
    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: http://riii.nl/apr5u, a step-by-step guide by Hanselman himself! – RobIII Apr 08 '13 at 07:04
  • 1
    @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 http://localhost:44300/ ? I am using IIS express 8 – DotnetSparrow Apr 08 '13 at 07:09
  • 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](http://www.hanselman.com/blog/WorkingWithSSLAtDevelopmentTimeIsEasierWithIISExpress.aspx) himself. – RobIII Apr 08 '13 at 07:09

54 Answers54

439

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"
Yehuda Shapira
  • 8,460
  • 5
  • 44
  • 66
  • 7
    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. – nthpixel Jul 18 '13 at 07:25
  • Worked for me too, although to stop the file being locked I had to go into task manager, show processes and end the IIS Express process (it's obvious what it's called). – Andy Brown Mar 22 '14 at 09:47
  • I had 'cannot read configuration file' errors after doing this. See http://stackoverflow.com/questions/15897726/iisexpress-8-cannot-read-configuration-file-redirection-config/24444023#24444023 – David Fidge Jun 27 '14 at 04:37
  • 60
    Thanks. Just don't forget to close then re-open VS for it to reconfigure the IIS Express. – Nick.T Jul 07 '14 at 13:21
  • 2
    I did that and it's not work for me then I restart the PC then all work calm. – Prageeth godage Sep 14 '14 at 11:12
  • This fixed this error and a problem I was having with website projects being renamed to something other than their directory name (detailed [here](http://stackoverflow.com/questions/27173749/i-cannot-get-projects-to-load-into-visual-studio-2013-with-the-same-name-as-thei/27173750#27173750)). – Chris Nov 28 '14 at 08:18
  • Did this solution, but also had to then reset up my startup project back to my web project via the Solution's properties, then change it from "Don't open a page. Wait for a request..." to "Current page". Worked fine after that. – vapcguy Mar 17 '15 at 21:20
  • [Recreating the virtual directory](http://stackoverflow.com/a/34161146/2404470) worked for me – Zameer Ansari Dec 10 '15 at 16:10
  • 1
    Worked for me after closing *all open instances* of Visual Studio. If I only re-start the .sln file that is giving me trouble, it doesn't work. I had to close down even my un-related solution files. – bkwdesign Feb 09 '16 at 17:50
  • 1
    MSVS 2015 creates an applicationhost.config under a separate .vs directory in the solution directory. the file can be renamed out of the way and then on a restart MSVS will re-create it. My issue was due to an extra "globalmodules" line "httpPlatofrmHandler" custom set to the 32 bit location". The event log may show clues to google and "Process Monitor" can capture the command line sent from MSVS which indicated the custom config in use. – crokusek Mar 02 '16 at 03:54
  • 9
    @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. – AJ. Aug 22 '16 at 16:26
  • I also had to close my browser windows that were running the app. – Darrell Lloyd Harvey Mar 20 '17 at 19:24
  • It would be a bad idea to delete the config file if you do have other sites and data in it. There can be easier ways to fix the file, like https://blog.lextudio.com/jexus-manager-recent-changes-to-save-the-world-ada896d098aa and I welcome all feedbacks. – Lex Li Jun 19 '17 at 00:51
  • 5
    Try to delete the **.vs** folder in project If someone still didn't work after doing it and restart the computer, – sknight Sep 07 '17 at 02:27
  • 1
    Issue for us was "The following error ocurred when trying to config IIS Express for project" {project name} ". Filename: redirection.config Error: Cannot read configuration file". This was on a MacBook Pro running a Windows 10 VM. Deleting the suggested folder worked perfectly. Thanks @YehudaShapira! – azarc3 Nov 21 '18 at 14:36
249

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 (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

enter image description here

Mihail Shishkov
  • 14,129
  • 7
  • 48
  • 59
  • 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!!! – code4life Jul 29 '16 at 13:36
  • work on VS 2915 @mihail i didn't delete anything, just create virtual directory ... what does it need for ? – abdoutelb Sep 21 '16 at 15:05
  • 4
    @AbdouTelb check this out http://www.iis.net/learn/get-started/planning-your-iis-architecture/introduction-to-applicationhostconfig 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 :) – Mihail Shishkov Sep 21 '16 at 15:14
  • Deleting the `applicationhost.config` under the `.vs/config` directory worked in VS2015. – ram Feb 16 '17 at 07:33
  • Make sure iisexpress is actually not running when you delete the config file. – Mihail Shishkov Mar 09 '17 at 09:03
  • I copied a solution structure (entire folder) over to a new machine and could not debug using IIS Express. I delete the .vs folder, after seeing this, and that solved the issue. Probably has to do with the previous config pointing to an invalid location as the previous solution was on a `D:` drive and the new one on `C:'. – Eben Roux Apr 11 '17 at 04:39
  • Can you please provide a demo or clear explanation regarding this , because you have mentioned You can do that by executing netstat -a -b in the console. – Meena Jun 30 '17 at 07:00
  • @Meena on the picture above, you see that the port used is 50333. You can run cmd as administrator, type netstat -a -b and check if there is an entry for this port 50333. 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. – Mihail Shishkov Jul 03 '17 at 08:27
84

@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

Hp_issei
  • 579
  • 6
  • 18
Jacob Lauzier
  • 865
  • 6
  • 3
  • 5
    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! – Geoffrey Apr 03 '14 at 11:51
  • 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. – Alisson Reinaldo Silva Jul 18 '16 at 16:44
  • Btw, if you have both http and https bindings, make sure you're not using the same port number on both of them. – Ziad Akiki Nov 15 '19 at 07:51
44

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.

Nate Anderson
  • 18,334
  • 18
  • 100
  • 135
centralscru
  • 6,580
  • 3
  • 32
  • 43
25

Try the following steps:

  1. delete the IISExpress folder as @Yehuda Shapira said
  2. restart computer
  3. delete the .vs folder in project
TylerH
  • 20,799
  • 66
  • 75
  • 101
sknight
  • 1,063
  • 11
  • 15
  • 4
    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. – akdora Jan 13 '19 at 14:48
  • 2
    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. – George Mar 29 '19 at 09:03
18

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

mat
  • 1,367
  • 1
  • 13
  • 18
  • 1
    Unfortunately this didn't help me. – AH. Oct 15 '16 at 13:57
  • 1
    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. – Nate R Jul 10 '20 at 22:19
  • Maybe some update was installed with administrator rights and since then it wouldn't work without admin privileges anymore. – mat Sep 09 '20 at 11:33
16

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

Vinu
  • 161
  • 1
  • 2
14

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.
TylerH
  • 20,799
  • 66
  • 75
  • 101
user2732247
  • 141
  • 1
  • 2
  • 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. – webworm Dec 23 '14 at 21:27
  • doesn't work for me. it all started when i messed with https – Toolkit Mar 25 '16 at 13:31
14

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!

Amir Chatrbahr
  • 2,260
  • 21
  • 31
10

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.

ArgisIsland
  • 407
  • 4
  • 9
  • 19
6

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.

splattne
  • 102,760
  • 52
  • 202
  • 249
Kerieks
  • 1,042
  • 7
  • 25
  • 53
6

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
Zameer Ansari
  • 28,977
  • 24
  • 140
  • 219
4

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.

deerchao
  • 10,454
  • 9
  • 55
  • 60
3

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.

JimmyV
  • 493
  • 3
  • 12
3

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.
TylerH
  • 20,799
  • 66
  • 75
  • 101
Saroj
  • 526
  • 1
  • 5
  • 17
3

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.

Witcher
  • 1,070
  • 2
  • 15
  • 38
  • Where do i go to "Edit project in solution"? I looked all over an ASP.NET web solution in Visual Studio for something like this and could not find anything like it. – TylerH Oct 10 '22 at 17:58
3
  1. Close all instances of Visual Studio.
  2. Open Task Manager.
  3. End all active IIS processes.
  4. Restart Visual Studio.
DMur
  • 625
  • 13
  • 26
2

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.

TylerH
  • 20,799
  • 66
  • 75
  • 101
Scott Decker
  • 4,229
  • 7
  • 24
  • 39
  • 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. – vapcguy Mar 18 '15 at 02:07
2

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

Zameer Ansari
  • 28,977
  • 24
  • 140
  • 219
RCanhestro
  • 39
  • 1
2

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.

TylerH
  • 20,799
  • 66
  • 75
  • 101
hadi ab
  • 21
  • 1
2

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

luk2302
  • 55,258
  • 23
  • 97
  • 137
2

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.

fefferoni
  • 211
  • 3
  • 7
2

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.

Giles Roberts
  • 6,407
  • 6
  • 48
  • 63
2

In my case my applicationhost.config file was somehow missing the following two lines 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" />
TylerH
  • 20,799
  • 66
  • 75
  • 101
Anshuman Jasrotia
  • 3,135
  • 8
  • 48
  • 81
2

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.

TylerH
  • 20,799
  • 66
  • 75
  • 101
Debashish Saha
  • 318
  • 1
  • 12
2

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

Ali Sadri
  • 1,570
  • 14
  • 15
  • 2
    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. – miki Feb 25 '20 at 18:03
1

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

user1161391
  • 121
  • 2
  • 9
1

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

Mohammad Dayyan
  • 21,578
  • 41
  • 164
  • 232
1

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.

Yasser Shaikh
  • 46,934
  • 46
  • 204
  • 281
1

My issue required a 3-fold solution:

  1. Remove the IISExpress folder in your Documents folder.
  2. Set the web project as your startup project by either right-clicking it and select "Set as startup project", or doing so through your solution properties.
  3. Set the startup URL, or set to "Current Page" or "Specific Page". Mine was set to "Don't open a page. Wait for a request from an external application" and I had to change it to "Specific Page", which I leave blank so it will go to my app's home page, before it would work.
vapcguy
  • 7,097
  • 1
  • 56
  • 52
1

My problem was eventually solved when I looked at the IIS Express registry key:

HKEY_CURRENT_USER\Software\Microsoft\IISExpress

I had an entry CustomUserHome pointing to My Web Sites which was causing havoc.

spenibus
  • 4,339
  • 11
  • 26
  • 35
AndyKenZ
  • 39
  • 7
1

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.

1

I was also facing this problem after I run XAMPP's Apache Server on my PC. For running it, I kill all the process on 8086 port by writing net stop http on the administrator command prompt. I think killing the processes caused this problem for me.

For me, this problem is solved after doing the following steps;

  1. Closing Visual Studio and SQL Management Studio.
  2. Going to Services and starting all SQL services except SQL Server Agent (SQLEXPRESS).
  3. Going to C:\Users\<your pc name>\Documents and deleting IISExpress folder.
  4. Restarting PC. (new thing todo which I don't found above)
  5. Starting the Visual Studio and running the program.
Zeeshan Ahmad Khalil
  • 793
  • 1
  • 12
  • 29
1

Right click on the project at solution explorer enter image description here

tab Web and Press the Create Virtual Directory

enter image description here

mirazimi
  • 814
  • 10
  • 11
0

Please go through the snapshot, I faced the same error but the following setting resolved it

  1. Select Current page as Start Action

  2. Select specific port in Servers option and enter port 26641 , in virtual path enter /

  3. NTLM option should be unchecked

Zameer Ansari
  • 28,977
  • 24
  • 140
  • 219
0

There is no need to delete the entire IISExpress folder in the directory C:\Users[you]\Documents\IISExpress.

Just comment:

<binding protocol="https" bindingInformation="*:8090:localhost" />

in the applicationhost.config file in the IISExpress folder.

Pang
  • 9,564
  • 146
  • 81
  • 122
0

Had been messing around with IISExpress and Project to try and get it listening on a different URL than localhost, when reverting back I had this error and after following all the answers here, none of them worked.

Eventually noticed that in the projects Porperties -> Web I had 'Start URL' checked under Start Action, but the input box was empty. Changing this to 'Current Page' fixed my issue.

MaxJ
  • 1,945
  • 2
  • 12
  • 19
0

The solution for me was switching from IIS Express to Local IIS. Solution properties Make sure though your virtual directory is bound to the same port.

PVitt
  • 11,500
  • 5
  • 51
  • 85
tanuk
  • 498
  • 9
  • 10
0

I ran into this exact problem recently and it was because the project was stored on a network drive. Since IIS locally runs as NetworkService it didn't have access to the network share where the project was stored. Assuming that opening a project from a network share is against best-practices, I copied the project to the local C:\ drive and then the project ran as expected.

Ron DeFulio
  • 125
  • 1
  • 7
0

I had the same issue. I resolve it by changing port number from project properties. I changed my port number 50624 to 50625.

enter image description here

Musakkhir Sayyed
  • 7,012
  • 13
  • 42
  • 65
0

I too had this issue, after turning off the firewall, after opening as administrator, after double checking all the settings were correct.

My problem was unique in that I wanted to test SSL locally, but also have the service available over the LAN. So I'd changed the app URL to use the local IP aka. 192.168.1.10 in my case.

Switching back to localhost fixed the problem, as did turning off SSL, so I discovered that the local SSL cert only worked for localhost.

David van Dugteren
  • 3,879
  • 9
  • 33
  • 48
0

Delete contents inside IISExpress folder and Close and Open the visual studio. and Run again. It should be fine.

Or Change the port number

Nalan Madheswaran
  • 10,136
  • 1
  • 57
  • 42
0

VS2015

edit file .csproj.user

Insert the following xml tags (do not duplicate if already exists)

<UseIIS>True</UseIIS>
<AutoAssignPort>True</AutoAssignPort>
<DevelopmentServerPort>2870</DevelopmentServerPort>
<DevelopmentServerVPath>/</DevelopmentServerVPath>
<IISUrl>http://localhost:2859</IISUrl>
<OverrideIISAppRootUrl>True</OverrideIISAppRootUrl>
<IISAppRootUrl>http://localhost:2859</IISAppRootUrl>
<NTLMAuthentication>False</NTLMAuthentication>
<UseCustomServer>False</UseCustomServer>
<CustomServerUrl>http://localhost/app</CustomServerUrl>

Insert above tags in XML node bellow:

<ProjectExtensions><VisualStudio><FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}"><WebProjectProperties> 
0

I had the same problem.Please Follow below steps :

1- Open applicationhost file in Documents\IISExpress\config and add below code if it's not exist

            <site name="solutionname" id="2">
                <application path="/" applicationPool="solutionname">
                    <virtualDirectory path="/" physicalPath="physicaladdressofproject" />
                </application>
                <bindings>
                    <binding protocol="http" bindingInformation="*:xxxx:localhost" />
                </bindings>
            </site>

2- Then go to the root file of your project and delete all of updates are done on the project by using different version of Visual Stdio

3- Next go to [root].vs\config and delete applicationhost it will be created automatically

4-Run the project

It worked for me.

Aida Bigonah
  • 197
  • 10
0

i will suggest one way to fix this issue:

1.Delete the \Documents\IISExpress folder using the following console command: rmdir /s /q "%userprofile%\Documents\IISExpress"

  1. Delete the applicationhost.config file which is placed within the .vs\Config\ folder in your Visual Studio project root folder.

  2. Change the project’s website random URL: within Visual Studio, right-click to the project node in Solution Explorer, then select Properties; navigate through the Web panel, then change the number in the Project Url textbox value.

  3. Add the _CSRUN_DISABLE_WORKAROUNDS Environment System variable with the value of 1 as shown in the following screenshot (thanks to Juan M. Elosegui for reporting this on this SO thread and for the image):

enter image description here

Good Luck !

yuvalchen
  • 133
  • 3
0

None of the methods presented here worked for me. What finally worked was to set the DevelopmentServerPort to 0 in the .csproj file:

    <WebProjectProperties>
      <UseIIS>True</UseIIS>
      <AutoAssignPort>True</AutoAssignPort>
      <DevelopmentServerPort>0</DevelopmentServerPort>
      <DevelopmentServerVPath>/</DevelopmentServerVPath>
      <IISUrl>http://localhost:52973/</IISUrl>
      <NTLMAuthentication>False</NTLMAuthentication>
      <UseCustomServer>False</UseCustomServer>
      <CustomServerUrl>
      </CustomServerUrl>
      <SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
    </WebProjectProperties>
Noel Lopes
  • 106
  • 6
0

I read all the answers herein and then, as mentioned in Mihail Shishkov answer, jumped to Project Properties > Web > Servers > Create Virtual Directory. This had the effect of getting me by the exception:

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

Adam Cox
  • 3,341
  • 1
  • 36
  • 46
0

For a 2021 Solution in dotnet core, you can fix this error by right-clicking the project in Solution Explorer, and choosing 'Edit Project File'.

On the Debug Tab, at the bottom, you can directly configure the desired port and whether to use SSL or not.

enter image description here

Changes here need to be saved with Control+S. Once that's done, you can launch the project and confirm it fixed your issue, no having to delete IISFolders or anything else suggested here.

FoxDeploy
  • 12,569
  • 2
  • 33
  • 48
-1

In my case, I went to Debug > Project Properties > Web (in visual studio) and then I changed IIS Express to Local IIS in servers section

Yehuda Shapira
  • 8,460
  • 5
  • 44
  • 66
relizondo6
  • 184
  • 5
-1

In my situation, the IIS Express applicationhost.config file had a typo in the managedRuntimeVersion attribute of several elements. This was happening for both Visual Studio 2012 and Visual Studio 2013. I only received the first part of the message, stating:

Unable to launch the IIS Express Web server.

It logged an error in the event log with the message:

The worker process failed to pre-load .Net Runtime version v4.030319.

The correct runtime version is v4.0.30319 (note the second period.)

The steps I took to correct:

  1. Navigate to C:\Users\\Documents\IISExpress\config
  2. Edit applicationhost.config
  3. Find the config section
  4. Correct any references to "v4.030319" to read "v4.0.30319"

Visual Studio successfully started IIS Express the next time I debugged a web application.

  • 1
    Why was this down voted? Seems like a completely plausible explanation for how to fix the problem. – dball Feb 25 '16 at 18:53
  • Unsure why anyone would have a typo like this in the `applicationhost.config`, unless someone that didn't know what they were doing was messing around. If it were an upgrade bug, I think it would be more profuse in the community that MS screwed up. I'm neutral as to if this is really a good answer. Something to try if all else fails, I guess, but certainly not where I'd start. – vapcguy Oct 14 '16 at 16:31
  • It can be a rare case for that file to be corrupt in this way, but I don't think anyone should down vote this. – Lex Li Jun 19 '17 at 00:58
-1

None of the other solutions worked for me. I disabled edit-and-continue, and all is well :)

Jacob Brewer
  • 2,574
  • 1
  • 22
  • 25
-1

Restarting the computer was the only thing that worked for me. Classic 101 IT :)

SylvainB2347
  • 349
  • 3
  • 7
  • In my case this started happening all of a sudden, everything was fine a minute before and nothing had changed. I right-clicked the project > Build. Once that finished I tried to debug again and it worked. – Greg Mar 17 '20 at 11:42
-1

Make sure you run the VS as administrator! That will solve everything. Than me later.

MUHINDO
  • 788
  • 6
  • 10
-4

Start with deleting the file IISEXPRESS that exists in your directory, then start debugging.

If that does not solve the problem, go to your Project (Ctrl+Alt+L). Right click -> Properties -> Debug and Check "Enable Windows Authentication".

Paul Roub
  • 36,322
  • 27
  • 84
  • 93