IIS Express + HttpPlatformHandler crash when launc

2019-06-17 02:56发布

问题:

After an upgrade from ASP.NET 5 beta 7 to RC1 an attempt to launch the web appplication in IIS Express from within Visual Studio ends with "An error occurred attempting to determine the process id of the DNX process hosting your application".

In Windows Event Log I can see following errors:

  • Process '1828' failed to start. Port = 31115, Error Code = '-2147024891'. (EventID 1000; this happens always)
  • Warning: Could not create stdoutLogFile \?\C:_temp_httpplatform-stdout.log_6072_2015128124832.log, ErrorCode = -2147024864. (EventID 1004; this happens only sometimes)

Log files as configured in the HttpPlatformHandler Configuration do get created but are completely empty, as well as VS Output window.

How can I diagnose the reason for the failure?

Relevant versions are:

  • Visual Studio Enterprise 2015 Update 1
  • DNX SDK version: 1.0.0-rc1-update1
  • Windows 7 Enterprise SP1 (64-bit)

Relevant sections from web.config:

<system.webServer>
  <handlers>
    <add name="httpPlatformHandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified" />
  </handlers>
  <httpPlatform processPath="%DNX_PATH%" 
                arguments="%DNX_ARGS%" 
                stdoutLogEnabled="true" 
                stdoutLogFile="C:\_temp\_httpplatform-stdout.log"
                startupTimeLimit="3600" 
                forwardWindowsAuthToken="false" />
</system.webServer>

What's perhaps also interesting is that initially when I tried to run a brand new ASP.NET 5 Web Application created from template, it worked. Now it doesn't either.

UPDATE: Despite the error IIS Express starts, but returns 502.3 Bad Gateway error

回答1:

So, one coworker had a similar problem.

I ended up checking the .vs\config\applicationhost.config file under the project. His turned out to have a bad < sites> section. Two of the sites were binding https to "*:44300:localhost". I removed one (the one that also bound http to 80), renumbered the sites, and his IIS Express now works.



回答2:

I just solved this issue for my sites ("An error occurred attempting to determine the process id of the DNX process hosting your application") - same boat, upgrading from Beta 7 to RC1. I believe these projects were originally created in Beta 4 or 5.

It turns out there was extra garbage in my web.config from earlier versions of the ASP.Net beta, and these were mucking up the request.

I removed these:

  <remove name="ExtensionlessUrlHandler-Integrated-4.0" />
  <remove name="OPTIONSVerbHandler" />
  <remove name="TRACEVerbHandler" />
  <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />

And the sites began running appropriately in IIS Express. If this doesn't work for you, you might try creating a new project and seeing if it works correctly - compare the web.config, startup, and project.json files to see if there are any other changes you need to make.



回答3:

I faced same problem when i started project via IIS Express. I got "An error occurred attempting to determine the process id of the DNX process hosting your application". I tried repair VS, reinstall IIS but nothing worked. And next day morning i found solution on asp toling known issues. Just reinstall ASP.NET 5 RC1.



回答4:

I have the same issue.

In the project.json file. My code was

"version": "1.0.0-rc1-update",

I change it to

"version": "1.0.0-rc1-update1",

Because in the launchSettings.json file I have "sdkVersion": "dnx-clr-win-x64.1.0.0-rc1-update1".

It must match the sdk version in launchSettings.json file.