364

I am trying to run any program on visual studio 2013 update 3 and I get the following alert box:

Process with an Id of #### is not running.

Every time there is different ID number showing.

and in the error windows, I get this error message:

The program '[3148] iisexpress.exe' has exited with code -1073741816 (0xc0000008) 'An invalid handle was specified'.

Sometimes it runs and in the browser I get the following message:

The webpage is not available.

Why is this occurring and how can I resolve it?

0

53 Answers 53

522

The following steps fix the problem for me:

  • Close Visual Studio
  • Navigate to the folder where your solution files are stored and delete the hidden .vs folder.
  • Restart Visual Studio
  • Hit F5 and IIS Express should load as normal, allowing you to debug.

Note: Based on my experience and others in the comments, this problem seems to be caused by moving a project between workstations, environments, or versions of Visual Studio. There must be some environment specific information contained in the .vs folder.

7
  • this is a great way to destroy a project
    – QBM5
    Commented Oct 24, 2016 at 0:17
  • 6
    @QBM5 how so? It might get rid of certain user settings and customizations but no code will be broken. Nothing you might have in version control would change. The .csproj remains intact. Plus, if it's in such a state that you cannot debug anyway, you've not got much to lose.
    – theyetiman
    Commented Oct 24, 2016 at 11:07
  • 3
    This basically worked for me for VS2017, but I was able to get away with just deleting the applicationhost.config file inside the vs folder in case this helps someone. Commented May 2, 2018 at 14:35
  • 1
    I am using VS2017 and just by deleting the file /.vs/<your-project>/DesignTimeBuild/.dtbcache I got it back on track. This avoids the whole .vs folder deletion which clears some VS2017 settings.
    – nrod
    Commented Jun 11, 2018 at 10:02
  • This worked for me but in combination with removing IIS Express folder as well Commented Dec 4, 2018 at 10:57
380
  1. Open Visual Studio as an administrator

  2. Right-click your project and click on 'Unload Project'

  3. Again, right-click your project and click on 'Edit PROJECT_NAME.csproj'

  4. Find the code below and delete it:

     <DevelopmentServerPort>63366</DevelopmentServerPort>
     <DevelopmentServerVPath>/</DevelopmentServerVPath>
     <IISUrl>http://localhost:63366/</IISUrl>
    
  5. Save and close the file .csproj

  6. Right-click your project and reload it

10
  • 20
    None of the other solutions worked for me but this. Doing the above will allow iis express to re-assign an open free port to run the web page in. Note: I wasn't able to rename the IISExpress folder because it said it was in use by myself (maybe a pc restart would have fixed it?). Commented Aug 25, 2016 at 22:48
  • 4
    This worked for me with one extra step - after reloading the project I also had to right-click on it again and select "Set as StartUp project" before it would run.
    – John M
    Commented Oct 21, 2016 at 7:33
  • 5
    dotnet core projects do not have these settings Commented Jul 10, 2018 at 18:45
  • 3
    This works because it assigns the project a new port number. Using the previous port number will likely still fail. Your original port is locked up by another service.
    – Rob
    Commented Mar 15, 2020 at 3:21
  • 6
    This didn't work for me, I don't have DevelopmentServerPort in my csproj Commented Jul 26, 2021 at 2:13
113

First Error

For the first error:

Process with an ID #### is not running.

The following steps worked for me:

  1. Close all instances of Visual Studio.
  2. Rename the IISExpress folder (in my PC is in C:\Users\jmelosegui\Documents).
  3. Add the _CSRUN_DISABLE_WORKAROUNDS Environment System variable with the value of 1. enter image description here
  4. Start Visual Studio in administrator mode. (In Windows, right click the executable file and select Run as administrator).

Second Error

The second error:

The webpage is not available

What caused this error:

I deleted IIS Express Development Certificate while playing with the SSL.

The following steps worked for me:

  1. Go to Control Panel.
  2. Select Add/Remove Programs.
  3. Locate IIS 8.0 Express.
  4. Right click on it then click Repair.
  5. Your certificate should be back!
11
  • 4
    I had to do the above, AND turn my computer off and on again (not just restart VS).
    – levininja
    Commented Jul 17, 2015 at 16:38
  • 6
    I simply renamed the IIS Express folder to something else. I didn't have to add the CSRUN variable. Step 1 & 2 was all I had to do.
    – AskYous
    Commented Sep 2, 2015 at 21:30
  • 2
    I tried several options and the only one that worked is this one. IISExpess is recreated after doing this but I don't see any difference between both configurations.The difference is ./vs/applicationhost.config file is completely rewritten but it looks more like organization instead of something special. Looks like the variable does the trick. Commented Oct 24, 2016 at 15:51
  • 1
    One or two steps are missing in this. Please check the following url too. ryadel.com/en/process-id-not-running-visual-studio-2015-fix
    – Jeeva J
    Commented Jul 19, 2018 at 5:07
  • 1
    Did you suggest that I should be running vs as admin from now on? Commented Feb 11, 2021 at 10:29
24

With respect to the first error:

Process with an ID #### is not running

This situation will sometimes occur when IIS Express fails to bind to a port. A likely reason for that is that some other process has already bound to that port. Visual Studio will launch the IISExpress.exe process (which will fail to bind to the port and exit again) and then attach to the now-terminated process, resulting in the above error.

To check, note the port number in your project settings (e.g. 12116) and then try:

netstat -ano | find "12116"

If another process has the port open, this will give its PID. You can then choose to kill the offending process or reallocate your own port number.

0
24

My fix was simple, I was missing prerequisites. I needed to install .NET Core SDK

5
  • 2
    Me too, I had an old project targeting "netcoreapp2.2" in my csproj, found the installer online (wasn't listed on the VS installer because it's EOL) and the project ran immediately. Commented Jan 28, 2022 at 13:38
  • This happened to me as well, even though I'd run the project before and didn't see any changes in the .csproj or .sln files - VS/msbuild suddenly started requiring the latest SDK
    – A N
    Commented May 17, 2022 at 15:14
  • me too, I had net6 SDK installed but the app was built on net5 Commented Aug 28, 2022 at 20:58
  • This solved my problem also. I had net core 6 and the project required net core 5. Commented Nov 17, 2022 at 16:14
  • Godo answer! This was my problem too (I hadn't installed the .NET 3.1 runtime). The error is not very clear! Commented Mar 5, 2023 at 22:26
20

If you are using a 64-bit machine

Then the problem maybe due to Visual Studio use of 32-bit IIS-Express.

Solution: In Visual Studio, go to Tools menu > Options > Projects and Solutions > Web Projects > Enable the option "Use the 64 bit version of IIS Express" and click ok

4
  • You'd think it would use the 64 bit version by default.
    – Menefee
    Commented Jun 4, 2018 at 16:06
  • Only discovered after checking the version of my OS that it is 64-bit That was the cause all along.Thanks
    – befree2j
    Commented Jul 4, 2019 at 9:24
  • I still got the error after activating this. Commented Oct 21, 2022 at 11:15
  • For my case was the opposit, I have to uncheck this and it worked. I think because I use windows on Mac M2 with Parallels
    – RADU
    Commented Feb 27 at 4:33
19

In my case, I run this command to get the real error:

dotnet run --project Project\MyProject.csproj

Then I see this error: enter image description here

I just installed the new version of dotnet and the error is gone.

4
  • This approach worked for me. I had the same problem. Commented Jan 18 at 9:26
  • 1
    In my case, I need to install an old version of .NET to make an old project to work.
    – Rich
    Commented Feb 29 at 16:52
  • 2
    IN 2024 This is the way
    – CodeMan03
    Commented Apr 18 at 16:15
  • Definitely this. Sometimes you also need to reboot in order for the new SDK version to be recognized. Commented May 16 at 14:53
15

I had the same problem. Just restarting Visual Studio worked for me.

2
  • 2
    If more than one instance of VS running, it seems they must all be closed
    – Phil
    Commented Jul 25, 2016 at 9:05
  • 6
    Tried all the solutions mentioned, nothing worked. Restarting the PC did the trick.
    – JayJay
    Commented Oct 18, 2016 at 16:18
15

Another reason this can happen is for a .NET Core Web app if you upgrade the Microsoft.AspNetCore.Components.* NuGet package to a new version but don't install the new SDK,

In my case it was upgrading Microsoft.AspNetCore.Components.WebAssembly from 6.0.0 to 6.0.1 and didn't install .NET 6.0.1 SDK

4
  • This is what happened to me. I received this error immediately after upgrading the MS nuget which was expecting the latest version of .NET Core. Commented Sep 19, 2022 at 16:28
  • Also happened to me. Commented Dec 20, 2022 at 19:20
  • Same here. I am happy I have found this so fast.
    – mynkow
    Commented Jan 18, 2023 at 20:32
  • same here, I tried to start an old .netcore 3.1 app but the framework was no longer available on my machine... Had to upgrade to .net 8 and it worked again :)
    – misanthrop
    Commented Feb 2 at 10:08
9

Kilanny's answer is correct. Most machines in 2015 are 64bit, so there's a lot of chances that you just need to enable the 64bit option under the Tools main navigation link menu. No need to configure other files or hard code ports. Besides, port assignment should be dynamic. This fix applies to 2013 With Update 3 and Visual Studio 2015 Community Edition.

Check the images below for a mini tutorial: (I'm just improving Kilanny's answer)

Visual Studio Tools Menu

Visual Studio Web Project Options

1
  • I've had this setting enabled for a couple weeks and the solution for me was to turn this off. Commented Aug 5, 2016 at 18:44
8

It looks like there are many solutions that work and some that don't...

My issue kept surfacing after a few test iterations. Yes restarting the PC and/or VS would resolve the issue...but temporarily.

My solution was to undo a security change I had enabled a couple days earlier to Controlled folder access under Ransomware protection.

I undid this change by:
(right click Start) Setting->Update & Security->Windows Security->Virus & threat protection-> Virus & threat protection settings->Manage settings

Under Controlled folder access Click->Manage Controlled folder access (this is also the Ransomware protection screen)

Turn Controlled folder access off.

This was 100% the issue for me as I was able to run my test without restarting VS.

3
  • 4
    I know you answered a long time ago, but your solution has finally resolved my issue. After playing around with all the other "solutions", turning off Controlled folder access resolved the issue. I took this one step further and instead of totally turning this off, I clicked the Allow an app through Controlled folder access and added an allowed app, selecting iisexpress.exe Commented May 14, 2019 at 18:54
  • 3
    A further note on this - you can be a bit more granular and just add IIS Express to the "allowed apps" in ransomware protection.
    – mutex
    Commented Jul 18, 2019 at 21:03
  • 1
    @mutex I'm gonna revisit this after your comment ...I did notice that I has added ISS Express that last time! I'm going to recreate the problem and see if I can nail it down a little more. Commented Jul 19, 2019 at 13:46
5

My solution to this on a new machine and fresh install of VS 2022 was to install the 3.1 framework. So check to make sure whatever framework the project is expecting is installed on your local machine.

5

I had a similar problem with Chrome. It appears that VS can't attach to the Chrome process for some reason.

Solution:

  1. Close Chrome
  2. With Chrome closed, start the web project and allow VS to open Chrome.
0
4

go to Properties of the start up project, increment port number of the Project Url is probably the quickest way to get around this problem which I didn't read anyone mentioned yet.

And you don't need to restart VS as it can be a pain sometimes if you needed a few other instances needed to be running.

4

Reboot your computer before trying any of these!

Some of these may be helpful. Doing the netstat trick

netstat -ano | find

helped me as another application was using my port, but didn't completely solve my problem. IIS Express still kept crashing. It wasn't until I rebooted my win 10 PC (first time in over a week), that my problem completely cleared up.

2
  • 1
    For me, begin by looking for the simplest, least destructive solutions first. I checked restart, and I had a pending windows update ready to install. When I updated (through restart) it then worked fine for me.
    – PTK
    Commented Apr 10, 2021 at 12:39
  • 1
    I had to do multiple reboots, eventually worked. Advice: maybe try two before trying other solutions. Commented Aug 31, 2023 at 21:30
4

I encountered this while trying to run a project I'd run many times on a machine I'd used for the project many times. Cleaning up my IIS Express directory and my .vs directory didn't work, nor did setting environment variables. I even tried re-cloning my repository to a different folder, but no success.

By trying to run via command line, I found a more useful message:

dotnet run --project [startup project path]

I saw that the project was trying to run using .NET 6.0.5, but I only had .NET 6.0.4 installed. Installing the latest .NET 6.0.5 from the Microsoft website worked.

1
  • Before you all trying other solutions try this. I had .net core 3.1 app and after fresh vs 2022 install i did not install unnecessary packages. I just only installed .net 6.0. But I could not open my app and it did not give me proper message. So i just install .net core 3.1 and it fixed.
    – Hakkı
    Commented Jun 13, 2022 at 11:09
4

I had the same problem, and what needed to be done was setup IIS Express properly.

I right clicked on my project Properties => Web (tab) and on Servers: Project URL was already pre-populated and I clicked the button "Create Virtual Directory".

I had just reinstalled (refreshed) windows and the IIS was not setup b/c it was new.

1
  • 1
    This worked for me - I actually changed it to a different port number as well and then was prompted to "Create Virtual Directory". That seems to have done the trick.
    – AVH
    Commented Jan 31, 2019 at 20:25
3

For me, none of the other solutions worked. The things I tried:

  • Updating and patching everything associated with Visual Studio
  • Reinstalling Visual Studio
  • Reinstalling IIS Express
  • Several reboots
  • Adding the _WORKAROUND thing to the PATH
  • Renaming the IIS folder under documents to regenerate the IIS config
  • Manually editing the csproj file and removing the whole IIS settings section
  • Changing the IIS executable usage to 64bit in VS settings
  • Changing the port of IIS in the projects settings

After checking if the problem was persistent over different projects, it turned out that the problem only occurred in one specific projects. I figured that I had to delete all the user specific files in the solutions folder (such as bin, obj, *.suo, ...) I just deleted the whole solution folder and reverted the files in git.

TLDR: Try deleting user specific files/folders like bin, obj, *.suo, ...

0
3

Close VS. Navigate to the folder of the solution and delete the hidden .vs folder. Restart VS. Hit F5 and IIS Express should load as normal, allowing you to debug.

If this not working, then:

  1. right click your solution and go to properties

  2. Click left menu Web tag

  3. Click checkbox "Override application root Url"

and run again your project.

1
  • 1
    This just repeats the top answer.
    – TylerH
    Commented Aug 3, 2022 at 15:34
3

Head to the following directory

%userprofile%\documents\IISExpress\Config directory

Delete all files within that folder. Restart visual studio and works like a charm.

0
2

I came across the same problem and found that somehow the file 'applicationhost.config' (in ..\Documents\IISExpress\config) had a different localhost port number (in the 'sites' section) to the one specified in project\properties\web. Changed them to the same number and the problem went away

2

What I did to make this go away:

Open C:\Users\gr_mext1\Documents\IISExpress\config\applicationhost.config and remove all <site> entries in <sites> do not remove <siteDefaults>!

In your project, go to Properties, Web and click "Create Virtual Directory".

Close and re-open visual studio, load your project and run

Fixed!

1
  • Only this worked for me. I removed entire IISExpress folder and that fixed the problem.
    – goodfellow
    Commented Jun 22, 2023 at 8:59
2

Tried most of the things here to no avail, but finally found a fix for my machine, so thought I'd share it:

Following previous advice in another question, I had used netsh to add :: to iplisten. It turns out undoing that was my solution, by simply replacing add in their advice:

netsh http delete iplisten ipaddress=::

You can also do this manually by deleting HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\HTTP\Parameters\ListenOnlyList from the registry and restarting the service/your PC.

2

For me this was the solution,

  1. Close all running Visual studio instances
  2. Open the solution folder and remove the .vs folder (hidden folder)
  3. Open Run Command
  4. Type iisreset and press Ok, and you may see a command prompt and wait for it to complete and it will close automatically

Now Open visual studio and run your project, it should run.

2

So, nothing worked for me and this happened to happen to me when I got a new machine. Apparently it didn't have the older versions of .Net on it. Went into VS Installer and checked the box for .Net 5 Runtime (VS 2022). Working fine now on all .Net 5 Projects.

1
  • 1
    In my case this issue reproduced after I uninstalled vs 2019 and installed vs 2022, by adding .net 5 runtime the issue was fixed the issue, thx a lot !
    – Alex
    Commented Mar 10, 2022 at 18:18
2

TL;DR: if you do have the right .NET Core (or .NET I guess) runtime installed, install any patch updates or reinstall the latest version if there aren't any.

Detail: Similar to a couple of other answers where they just didn't have the right .NET core installed. I was trying to run a .NET Core 3.1 web app which had worked fine previously for months, and this suddenly started happening.

I did have 3.1 (runtimes 3.1.21 and 3.1.22) installed. However a new one (3.1.23) had been released 12 days earlier, and installing that fixed the problem.

I have no idea if this was because it's aware that there's a new patch and I didn't have it so it wouldn't run, or if there was just something wrong with my 3.1.22 installation. Worth trying installing latest patch, or reinstalling existing installations.

2

I also had the same problem, doing the above didn't work for me. What my error turned out to be was twofold.

  1. I had Opera as my default browser and it couldn't attach to that.
  2. I had multiple startup projects so it wouldn't let me switch to IE until I change the default startup project back to just the MVC shell.

I set that project specifically as the startup, then I switched it back to launching IE and it started debugging again.

2

In my case I had to update Visual studio 2022 from Visual Studio Installer. I was using Blazor and .Net7 and the blazor app wouldn't launch. By the way, I will add, remember to update the SDK, and the blazor if it concerns you.

2

In my case dotnet app was hitting an exception. Best way is to look at the application event log

Description: A .NET application failed.
Application: XX.Api.exe
Path: C:\XX.Api\bin\Debug\net6.0\XX.Api.exe
Message: You must install or update .NET to run this application.

App: C:\XX.Api\bin\Debug\net6.0\XX.Api.exe
Architecture: x64
Framework: 'Microsoft.NETCore.App', version '6.0.27' (x64)

.NET location: C:\Program Files\dotnet\

The following frameworks were found:
  3.1.32 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  5.0.17 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  6.0.26 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]

Installing dotnet 6 fixed the issue

1
  • This was my issue -- was targeting a version of .NET SDK that wasn't installed.
    – Brian Lacy
    Commented Mar 30 at 16:17
1

None of the listed solutions worked for me. Problem was some sort of conflicting state in local applicationhost.config file. Fix is easy, just delete one in your solution. For VS2015 it should be located in <path_to_your_solution>\Solution\.vs\config\. When you launch Debug, VS will recreate that file based on settings in your project file.

Not the answer you're looking for? Browse other questions tagged or ask your own question.