1
votes

I got below log error when I publish my ASP.NET 5 RC1 project to the IIS server.

Failed to initialize runtime 0x

IIS 7.5, installed 64 bit HTTP Platform Handler and followed below instructions docs.asp.net/en/latest/publishing/iis.html

I have the project working well locally with VS2015 and IIS Express. Any idea about this error?

Updated approot folder structure:

here

Runtimes folder:

here

Web.config in wwwroot(auto-generated):

<configuration>
  <system.webServer>
    <handlers>
      <add name="httpplatformhandler" path="*" verb="*"
           modules="httpPlatformHandler" resourceType="Unspecified" />
    </handlers>
    <httpPlatform processPath="..\approot\web.cmd" 
           arguments="" 
           stdoutLogEnabled="false" 
           stdoutLogFile="..\logs\stdout.log" 
           startupTimeLimit="3600" 
           forwardWindowsAuthToken="true"></httpPlatform>
  </system.webServer>
</configuration>

web.cmd in approot(auto-generated):

@echo off
SET DNX_FOLDER=dnx-clr-win-x64.1.0.0-rc1-update1
SET "LOCAL_DNX=%~dp0runtimes\%DNX_FOLDER%\bin\dnx.exe"

IF EXIST %LOCAL_DNX% (
  SET "DNX_PATH=%LOCAL_DNX%"
)

for %%a in (%DNX_HOME%) do (
    IF EXIST %%a\runtimes\%DNX_FOLDER%\bin\dnx.exe (
        SET "HOME_DNX=%%a\runtimes\%DNX_FOLDER%\bin\dnx.exe"
        goto :continue
    )
)

:continue

IF "%HOME_DNX%" NEQ "" (
  SET "DNX_PATH=%HOME_DNX%"
)

IF "%DNX_PATH%" == "" (
  SET "DNX_PATH=dnx.exe"
)

@"%DNX_PATH%" --project "%~dp0src\Pms.Client.Web" --configuration Debug web %*

Tried to use WinDbg the dnx.exe on server and got below error code. Hope someone is able to interpret for me. Thanks!

ModLoad: 000007fe`f96d0000 000007fe`fa035000   C:\Windows\Microsoft.NET\Framework64\v4.0.30319\clr.dll
ModLoad: 000007fe`fa530000 000007fe`fa601000   C:\Windows\system32\MSVCR100_CLR0400.dll
(668.126c): Unknown exception - code 04242420 (first chance)
    ModLoad: 000007fe`ee610000 000007fe`ef889000   C:\Windows\assembly\NativeImages_v4.0.30319_64\mscorlib\7f2c596fb4811af2d6fc7a5132c75d10\mscorlib.ni.dll
    ModLoad: 000007fe`f5510000 000007fe`f5524000   C:\Windows\Microsoft.NET\Framework64\v4.0.30319\nlssorting.dll
    ModLoad: 000007fe`fc850000 000007fe`fc868000   C:\Windows\system32\CRYPTSP.dll
    ModLoad: 000007fe`fc3b0000 000007fe`fc3f7000   C:\Windows\system32\rsaenh.dll
    ModLoad: 000007fe`fcd20000 000007fe`fcd2f000   C:\Windows\system32\CRYPTBASE.dll
    ModLoad: 000007fe`f4d90000 000007fe`f4f03000   C:\Windows\Microsoft.NET\Framework64\v4.0.30319\clrjit.dll
    (668.126c): C++ EH exception - code e06d7363 (first chance)
    (668.126c): CLR exception - code e0434352 (first chance)
    (668.126c): C++ EH exception - code e06d7363 (first chance)
    (668.126c): CLR exception - code e0434352 (first chance)
    (668.126c): C++ EH exception - code e06d7363 (first chance)
    (668.126c): CLR exception - code e0434352 (first chance)
    (668.126c): C++ EH exception - code e06d7363 (first chance)
    (668.126c): CLR exception - code e0434352 (first chance)
    ntdll!ZwTerminateProcess+0xa:
1
Got same error when I execute web.cmd in approot folder. - DonnyTian
could you run "dnvm list" in a command prompt? - Danny van der Kraan
No, "dnvm" is not recognized as a command. Do I have to install something else in my server? - DonnyTian
@ShaunLuttin, I just published via VS2015, right click the web project and and go with "Publish" to file system. In IIS side, as I mentioned I followed the official instruction to config the web server. Thanks! - DonnyTian
@ShaunLuttin This is the first version I touched with asp.net core. - DonnyTian

1 Answers

1
votes

Figured out this issue. The answer is simple enough, but the story is long.

I just installed .NET Framework 4.5.1 on server and the error has gone.

Then I got another well-known issue about "

you must add reference assembly to System.Runtime

"

Tried every way I found in this site and gave up eventually. The magic came out when I checked option to build binaries when publishing: image here.

Just post this workaround for peoples that may encounter similar situation. Still I am not very clear about underlying things.