102

I get this error message when I'm trying to start the application.

An error occurred attempting to determine the process id of the DNX process hosting your application

Is there a way to fix the problem?

0

17 Answers 17

152

For me the problem was solved by closing down Visual Studio, deleting

project.lock.json

and starting Visual Studio again.

Edit: I was using RC1.

6
  • 2
    Solved my problem in RC1 project
    – Nadav Hury
    Dec 24, 2015 at 10:47
  • @NadavHury Same here :) Jan 1, 2016 at 11:19
  • 1
    Solved the problem I had with example RC1 app downloaded from PluralSight, much appreciated
    – tomRedox
    Jan 6, 2016 at 23:43
  • 6
    this doesn't work anymore. np microsoft. we'll figure it out. again and again and... AGAIN
    – user2102611
    Aug 23, 2016 at 1:16
  • 1
    where is project.lock.json? May 9, 2019 at 15:02
34

Microsoft changed the hosting model as described in the release notes.

In project.json replace the dependency

"Microsoft.AspNet.Server.IIS": "1.0.0-beta7"

with

"Microsoft.AspNet.Server.Kestrel": "1.0.0-beta8"


In web.config in the handlers section remove every entry except

<add name="httpPlatformHandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified" />

The complete web.config will look like this:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <system.webServer>
    <handlers>
      <add name="httpPlatformHandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified"/>
    </handlers>
    <httpPlatform processPath="%DNX_PATH%" arguments="%DNX_ARGS%" stdoutLogEnabled="false" startupTimeLimit="3600"/>
  </system.webServer>
</configuration>

RC1: While using RC1 I had the error after moving the solution folder. After deleting the bin and obj folders everything worked again.
As user764754 noted, simply restarting Visual Studio can also help.

10
  • In the new hosting model, you don't use web.config at all and can remove it entirely. The httpPlatformHandler and Startup.cs supplant web.config, as you're bypassing IIS to a certain extent.
    – cygnim
    Oct 17, 2015 at 12:44
  • 2
    I use the newest templates after installing 1.0.0-beta8 first, then creating a new ASP.NET project in VS 2015. All entries are correct, still I get the same error as Domysee. Could someone please explain what "%DNX_PATH%"and "%DNX_ARGS%" mean?
    – okieh
    Oct 17, 2015 at 16:25
  • 2
    I should clarify, you don't need a web.config in your project. A minimal web.config file is generated during compilation which basically adds the HttpPlatformHandler to the pipeline and directs traffic away from IIS to the Kestrel server. So you're right, there is a web.config file, but it not necessary in your project code base.
    – cygnim
    Oct 19, 2015 at 17:14
  • 3
    Just restarting VS did it for me with RC-1 no deletions required.
    – user764754
    Dec 9, 2015 at 12:39
  • 2
    I had the same issue with RC1 the solution for me was to delete the web.config (in wwwroot)
    – rad
    Dec 14, 2015 at 23:39
30

For other people having this problem, in cases in which the other solutions don't work - I found the answer in this thread: Forcing to use SSL: An error ocurred attempting to determine the process id of the DNX process hosting your application

I your project uses or enforces SSL run it without debugging (CTRL+F5) first, it will ask you to generate a local SSL cert, and after that debugging will work and the error will be gone.

3
  • This fixed it for me. I had migrated my project to a new computer which hadn't had the certificate installed. Thanks.
    – Pace
    Aug 13, 2016 at 16:44
  • Nice, that was it! I'm going to note this on the "Enabling authentication using Facebook..." page, as their instructions include forcing SSL.
    – N8allan
    Oct 14, 2016 at 16:49
  • I couldn't get it to work by doing CTRL+F5. F5 worked after running this to trust my iis express certs. I had no warnings, but this fixed it for me.
    – Josh Close
    Mar 21, 2017 at 15:15
11

For what it's worth, this is a generic error message that could serve as a red herring to any number of issues where the httpPlatformHandler can't launch the given executable (dnx in this case).

In my case I received this error as a direct result of misunderstanding the launchSettings.json file. I was trying to enable the https endpoint for my application and mistakenly duplicated the sslport in my applicationUrl. As I understand it the applicationUrl should be the http hostname/port of the application and by filling in the sslPort it just configures the IIS Express environment to listen for https on the hostname given in the applicationUrl on the port provided in sslPort.

For example:

  "iisSettings": {
     "windowsAuthentication": false,
     "anonymousAuthentication": true,
     "iisExpress": {
       "applicationUrl": "http://localhost:44000",
       "sslPort": 44300
      }
  }

Provides the following two endpoints on localhost.

  • Http over port 44400
  • Https over port 44300

If you were to have the same port in the applicationUrl and sslPort settings, you would receive the error associated with this thread.

This is true for me on RC1

2
  • Why is it that sslPort should be different from applicationUrl? It used to work for me until RTM... Jun 28, 2016 at 6:05
  • I had the error: unable to connect to web server 'IIS Express' , and after deleting the "\.vs\config\applicationhost.config file" i got the error "an error occurred attempting...". In project propperties>debug I unticked SSL, ran the debugger (working), ticked the SSL again and copied the URL to "App URL", debugging in SSL mode works again. The error appeared after a windows update, not sure if it was the cause though. My iisSettings are now "iisExpress": { "applicationUrl": "localhost:44369", "sslPort": 44369 } .. it works if the port numbers are not the same
    – JimiSweden
    Dec 22, 2016 at 8:51
6

It is possible to upgrade, i found i had to look through the new updated templates here.

Update your web.config in wwwroot to include:

<httpPlatform processPath="%DNX_PATH%" arguments="%DNX_ARGS%" stdoutLogEnabled="false" startupTimeLimit="3600"/>

You will also need to change the way the project debugs using Kestrel by modifying your project.json:

"commands": {
  "web": "Microsoft.AspNet.Server.Kestrel"
},
"dependencies": {
  "Microsoft.AspNet.IISPlatformHandler": "1.0.0-beta8",
  "Microsoft.AspNet.Server.Kestrel": "1.0.0-beta8",
}

and modifying your hosting.ini

server=Microsoft.AspNet.Server.Kestrel

and adding this to the Configure method in startup.cs

// Add the platform handler to the request pipeline.
app.UseIISPlatformHandler(); 

adding these references should allow you to run the project.

5

I hit this problem due to the project config trying launch https://localhost instead of http. Right click on the webproject, under "Debug" and adjust "App URL" to be http instead of https. enter image description here

Another way to get around this was switching the launcher from "IIS Express" to "Web"

3

In Visual Studio:

While following this tutorial I received a similar error.

First, I received the error: "An error occurred attempting to determine the process id of dotnet.exe..." I took the following steps.

  1. I started my application without debugging CTRL+F5.
  2. I was then presented with an option to accept a self-signed certificate for localhost.
  3. I followed the prompts and then I was able to visit my application using the AppUrl I copied over after enabling SSL in project debug settings.

While trying a few things to solve that error I also came across this error. "An error occurred attempting to determine the process id of the DNX process hosting your application"

Which was caused by having another instance of the application running.

I hope this answer helps someone.

1
  • Wait, so the answer is "caused by having another instance of the application running"? Should make this more obvious right away.
    – Bloodied
    Oct 18, 2016 at 7:01
2

In my case in an asp net core 1.1, .net framework 4.5.2 project, the error did not refer to dnx since that is no more. Instead it referred to the project name exe. Another version of the error referred to simply being unable to connect to iis express.

The problem was the introduction of a canonical host name rewrite rule that tries to force all connections to have a host name that begins with www. e.g. redirecting gty.org to www.gty.org to conform to our ssl cert. This is fine in production but you can't force https://localhost:44347/ to begin with www and expect iis express to be able to handle it.

<rule name="CanonicalHostNameAddwww" enabled="true" stopProcessing="true">
      <match url="(.*)" ignoreCase="true" />
      <conditions logicalGrouping="MatchAll">        
        <add input="{HTTP_HOST}" negate="true" pattern="^www\." />
      </conditions>
      <action type="Redirect" url="http://www.{HTTP_HOST}{HTTP_URL}"  appendQueryString="false" redirectType="Permanent" />
</rule>

The solution was to comment out the rule when running in visual studio or add a condition:

<add input="{HTTP_HOST}" negate="true" pattern="^localhost" />
2

Assuming you are running IIS Express with SSL Enabled depending on your installation you will have to put your IIS Express Development Certificate(Issued To "localhost"/ Issued By "localhost") in either [Local Computer\Personal\Certificates] or [Local Computer\Trusted Root Certification\Certificates]. One of those should work. (Using Windows 10 + VS2015). HTH

1
  • Adding the IIS Express Development Certificate in Local Computer\Trusted Root Certification\Certificates did the job for me. Thanks! (For anyone else, in my case I already had the certificate in Local Computer\Personal\Certificates)
    – David Aleu
    Jan 15, 2017 at 16:28
1

Check web.config file for invalid entries. For example, having "entityFramework" tag there causes this problem for me.

1

I had this trouble when I'm toggling settings and have disabled the "Enable Anonymous Authentication" in the Project > Properties > Debug. Make sure that it is enabled. Close and relaunched the project then try again. Hope this helps.

1
  • I had the same issue, but rather than only having to enable anonymous, I had to enable either anonymous or windows authentication. If both were false, I got the error.
    – birken25
    Jun 6, 2016 at 16:41
1

I used RC1 and EF First Code Approach. Good idea to start investigation is to run project with option: "Start project without debbuging" (Ctrl+F5). Then I get more meaningful error for me: "The configuration section 'entityFramework' cannot be read because it is missing a section declaration." It didn't work for me because of web.config file.

1
  1. Update dnvm
  2. Change global.json sdk version as the dnvm's default
  3. No need to touch project.json or project.lock.json
0
0

When upgrading from beta7 -> beta8 I had this issue and the suggestions provided by Ben M and Domysee worked for me. However, one of my colleagues was still having problems running our project which targets dnxcore50 only. If you make sure you have run the following commands:

dnvm install 1.0.0-beta8 -r coreclr
dnvm install 1.0.0-beta8 -r coreclr -arch x86

It was the second command in particular that fixed it on his machine. You can also double-check this folder has a dnx.exe in it:

%userprofile%\.dnx\runtimes\dnx-coreclr-win-x86.1.0.0-beta8\bin
0

I've just discovered one more problem that was causing this!

web.config in project root had some dodgy IIS URL rewrite rules to enforce HTTPS. Removing those rules solved the problem.

0

There are just so many things that could cause this error. Here are a few that worked for me:

  1. Just delete the web.config in your wwwroot folder. It will get recreated correctly on compilation.
  2. If you are trying to use SSL and in your IIS Express and moving your SSL Cert to the Trusted Root Certification Authorities folder didn't work. In the Debug tab of the Properties of the project you are trying to run. Try unclicking the Enable SSL checkbox and then clicking it again to enable it and get a different port. You may have to do this a few times.
0
0

Another potential solution
For anyone playing with SSL settings, I found just changing the SSL port in the launchSettings.json file to another nearby port solved the problem.

FYI, I couldn't find anything on the machine using the original port, nor did I get a port in use error.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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