Aspnetcore: Inprocess application start problem

Created on 25 Dec 2018  ·  3Comments  ·  Source: dotnet/aspnetcore

Hello!
I'm trying to host web app using inprocess hosting model. And...
Application can't start.
IIS responses with 500.30.
ANCM logs contains this.
If i switch hostingModel to OutOfProcess — everything is ok.

My web.config

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <system.webServer>
      <handlers>
        <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
      </handlers>
      <aspNetCore processPath=".\Dodo.ClientSite.exe" arguments="" stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false" hostingModel="InProcess">

         <handlerSettings>
                  <handlerSetting name="debugFile" value=".\aspnetcore-debug.log" />
                  <handlerSetting name="debugLevel" value="FILE,TRACE" />
              </handlerSettings>
      </aspNetCore>
   </system.webServer>
</configuration>

Logs

```
[aspnetcorev2.dll] ASPNET_CORE_GLOBAL_MODULE::OnGlobalConfigurationChange 'MACHINE/WEBROOT/APPHOST/RU-DEV-GS-GSITE.EXT.DEV.DODOIS.COM'
[aspnetcorev2.dll] Stopping application '/LM/W3SVC/340/ROOT'
[aspnetcorev2_inprocess.dll] Stopping file watcher thread
[aspnetcorev2.dll] ASPNET_CORE_GLOBAL_MODULE::OnGlobalStopListening
[aspnetcorev2.dll] ASPNET_CORE_GLOBAL_MODULE::Terminate
[aspnetcorev2.dll] Initializing logs for 'C:\Program Files\IIS\Asp.Net Core Module\V2\aspnetcorev2.dll'. Process Id: 9476.. File Version: 12.2.18316.0. Description: IIS ASP.NET Core Module V2. Commit: ce8cf65589734f82b0536c543aba5bd60d0a5a98.
[aspnetcorev2.dll] Resolving hostfxr parameters for application: '.\Dodo.ClientSite.exe' arguments: '' path: 'E:\sites\ru-dev-gs-gsite.ext.dev.dodois.com\'
[aspnetcorev2.dll] Known dotnet.exe location: ''
[aspnetcorev2.dll] Process path '.\Dodo.ClientSite.exe' is not dotnet, treating application as standalone or portable with bootstrapper
[aspnetcorev2.dll] Checking application.dll at 'E:\sites\ru-dev-gs-gsite.ext.dev.dodois.com.\Dodo.ClientSite.dll'
[aspnetcorev2.dll] Checking hostfxr.dll at 'E:\sites\ru-dev-gs-gsite.ext.dev.dodois.com.\hostfxr.dll'
[aspnetcorev2.dll] hostfxr.dll found app local at 'E:\sites\ru-dev-gs-gsite.ext.dev.dodois.com.\hostfxr.dll', treating application as portable with launcher
[aspnetcorev2.dll] Resolving absolute path to dotnet.exe from 'dotnet'
[aspnetcorev2.dll] Invoking where.exe to find dotnet.exe
[aspnetcorev2.dll] where.exe invocation returned: 'C:\Program Filesdotnetdotnet.exe
C:\Program Files (x86)dotnetdotnet.exe
'
[aspnetcorev2.dll] Current process bitness type detected as isX64=1
[aspnetcorev2.dll] Processing entry 'C:\Program Filesdotnetdotnet.exe'
[aspnetcorev2.dll] Binary type 6
[aspnetcorev2.dll] Found dotnet.exe via where.exe invocation at 'C:\Program Filesdotnetdotnet.exe'
[aspnetcorev2.dll] Resolving absolute path to hostfxr.dll from 'C:\Program Filesdotnetdotnet.exe'
[aspnetcorev2.dll] hostfxr.dll located at 'C:\Program Filesdotnet\host\fxr\2.2.0\hostfxr.dll'
[aspnetcorev2.dll] Parsed hostfxr options: dotnet location: 'C:\Program Filesdotnetdotnet.exe' hostfxr path: 'C:\Program Filesdotnet\host\fxr\2.2.0\hostfxr.dll' arguments:
[aspnetcorev2.dll] Argument[0] = 'C:\Program Filesdotnetdotnet.exe'
[aspnetcorev2.dll] Argument[1] = 'E:\sites\ru-dev-gs-gsite.ext.dev.dodois.com.\Dodo.ClientSite.dll'
[aspnetcorev2.dll] c:\b\w\e37dd45d8cd1eaf4\src\iisintegration\src\aspnetcoremodulev2\commonlib\fileoutputmanager.cpp:142 Operation failed with LastError: 32 HR: 0x80070020
[aspnetcorev2.dll] Loading request handler: 'E:\sites\ru-dev-gs-gsite.ext.dev.dodois.com\aspnetcorev2_inprocess.dll'
[aspnetcorev2.dll] Creating handler application
[aspnetcorev2_inprocess.dll] Initializing logs for 'E:\sites\ru-dev-gs-gsite.ext.dev.dodois.com\aspnetcorev2_inprocess.dll'. Process Id: 9476.. File Version: 12.2.18316.0. Description: IIS ASP.NET Core Module V2 Request Handler. Commit: ce8cf65589734f82b0536c543aba5bd60d0a5a98.
[aspnetcorev2_inprocess.dll] Waiting for initialization
[aspnetcorev2_inprocess.dll] Starting in-process worker thread
[aspnetcorev2_inprocess.dll] Resolving hostfxr parameters for application: '.\Dodo.ClientSite.exe' arguments: '' path: 'E:\sites\ru-dev-gs-gsite.ext.dev.dodois.com\'
[aspnetcorev2_inprocess.dll] Known dotnet.exe location: 'C:\Program Filesdotnetdotnet.exe'
[aspnetcorev2_inprocess.dll] Process path '.\Dodo.ClientSite.exe' is not dotnet, treating application as standalone or portable with bootstrapper
[aspnetcorev2_inprocess.dll] Checking application.dll at 'E:\sites\ru-dev-gs-gsite.ext.dev.dodois.com.\Dodo.ClientSite.dll'
[aspnetcorev2_inprocess.dll] Checking hostfxr.dll at 'E:\sites\ru-dev-gs-gsite.ext.dev.dodois.com.\hostfxr.dll'
[aspnetcorev2_inprocess.dll] hostfxr.dll found app local at 'E:\sites\ru-dev-gs-gsite.ext.dev.dodois.com.\hostfxr.dll', treating application as portable with launcher
[aspnetcorev2_inprocess.dll] Resolving absolute path to hostfxr.dll from 'C:\Program Filesdotnetdotnet.exe'
[aspnetcorev2_inprocess.dll] hostfxr.dll located at 'C:\Program Filesdotnet\host\fxr\2.2.0\hostfxr.dll'
[aspnetcorev2_inprocess.dll] Parsed hostfxr options: dotnet location: 'C:\Program Filesdotnetdotnet.exe' hostfxr path: 'C:\Program Filesdotnet\host\fxr\2.2.0\hostfxr.dll' arguments:
[aspnetcorev2_inprocess.dll] Argument[0] = 'C:\Program Filesdotnetdotnet.exe'
[aspnetcorev2_inprocess.dll] Argument[1] = 'E:\sites\ru-dev-gs-gsite.ext.dev.dodois.com.\Dodo.ClientSite.dll'
[aspnetcorev2_inprocess.dll] Managed threw an exception -1073741819
[aspnetcorev2_inprocess.dll] Starting shutdown sequence 1
[aspnetcorev2_inprocess.dll] Clr thread wait ended: clrThreadExited: 1
[aspnetcorev2_inprocess.dll] c:\b\w\e37dd45d8cd1eaf4\src\iisintegration\src\aspnetcoremodulev2\commonlib\fileoutputmanager.cpp:142 Operation failed with LastError: 32 HR: 0x80070020
[aspnetcorev2_inprocess.dll] Event Log: 'Application '/LM/W3SVC/340/ROOT' with physical root 'E:\sites\ru-dev-gs-gsite.ext.dev.dodois.com\' hit unexpected managed exception, exception code = '0xc0000005'. Please check the stderr logs for more information.'
End Event Log Message.
[aspnetcorev2_inprocess.dll] Stopping in-process worker thread
[aspnetcorev2_inprocess.dll] Stopping CLR
[aspnetcorev2_inprocess.dll] Event Log: 'Application '/LM/W3SVC/340/ROOT' with physical root 'E:\sites\ru-dev-gs-gsite.ext.dev.dodois.com\' failed to load clr and managed application. CLR worker thread exited prematurely'
End Event Log Message.
[aspnetcorev2_inprocess.dll] Exception 'InvalidOperationException' caught at c:\b\w\e37dd45d8cd1eaf4\src\iisintegration\src\aspnetcoremodulev2\inprocessrequesthandler\inprocessapplication.cpp:350
[aspnetcorev2_inprocess.dll] Failed HRESULT returned: 0x8007023e at c:\b\w\e37dd45d8cd1eaf4\src\iisintegration\src\aspnetcoremodulev2\inprocessrequesthandler\dllmain.cpp:120
[aspnetcorev2_inprocess.dll] Starting app_offline monitoring in application 'E:\sites\ru-dev-gs-gsite.ext.dev.dodois.com\'
[aspnetcorev2_inprocess.dll] Starting file watcher thread
[aspnetcorev2.dll] ASPNET_CORE_GLOBAL_MODULE::OnGlobalConfigurationChange 'MACHINE/WEBROOT/APPHOST/RU-DEV-GS-GSITE.EXT.DEV.DODOIS.COM'
[aspnetcorev2.dll] Stopping application '/LM/W3SVC/340/ROOT'
[aspnetcorev2_inprocess.dll] Stopping file watcher thread
[aspnetcorev2.dll] ASPNET_CORE_GLOBAL_MODULE::OnGlobalStopListening
[aspnetcorev2.dll] ASPNET_CORE_GLOBAL_MODULE::Terminate
````

area-servers servers-iis

Most helpful comment

Your Program.Main is throwing an exception. It's probably due to the CurrentDirectory issue: #4206. Here is our recommended workaround for now: https://github.com/aspnet/Docs/blob/master/aspnetcore/host-and-deploy/aspnet-core-module/samples_snapshot/2.x/CurrentDirectoryHelpers.cs. This will be fixed in a patch.

I'm having problems applying the suggested fix and resolving the issue which I don't know if it should be fixed in the current version .Net Core 2.2 since I am still getting the same error - IIS responses with 500.30 - when running InProcess. Enabling the logs I could see the problem is related to the same issue as the directory returned is not the correct directory. Instead, it returned the path where the IIS service run from in the system. To apply the fix, I've copied the CurrentDirectoryHelper.cs to my project and call it from the Program.cs before Setting the SetBasePath,

logger.LogWarning($"Applying Patch to fix Current Directory issue. Current Directory: {Environment.CurrentDirectory}"); //TODO: the line below can be removed when the bug with InProcess method is fixed (more details, follow the class definition and read the comments) CurrentDirectoryHelpers.SetCurrentDirectory(); logger.LogWarning($"Fix applied. Current Directory now is: {Environment.CurrentDirectory}");
Applying the fix as such still produces the same result.
The Application starts fine if running as OutOfProcess and if running under IIS Express

Can anyone help me with this, please?

All 3 comments

Your Program.Main is throwing an exception. It's probably due to the CurrentDirectory issue: #4206. Here is our recommended workaround for now: https://github.com/aspnet/Docs/blob/master/aspnetcore/host-and-deploy/aspnet-core-module/samples_snapshot/2.x/CurrentDirectoryHelpers.cs. This will be fixed in a patch.

I assume the workaround has resolved your issue. Feel free to reopen otherwise.

Your Program.Main is throwing an exception. It's probably due to the CurrentDirectory issue: #4206. Here is our recommended workaround for now: https://github.com/aspnet/Docs/blob/master/aspnetcore/host-and-deploy/aspnet-core-module/samples_snapshot/2.x/CurrentDirectoryHelpers.cs. This will be fixed in a patch.

I'm having problems applying the suggested fix and resolving the issue which I don't know if it should be fixed in the current version .Net Core 2.2 since I am still getting the same error - IIS responses with 500.30 - when running InProcess. Enabling the logs I could see the problem is related to the same issue as the directory returned is not the correct directory. Instead, it returned the path where the IIS service run from in the system. To apply the fix, I've copied the CurrentDirectoryHelper.cs to my project and call it from the Program.cs before Setting the SetBasePath,

logger.LogWarning($"Applying Patch to fix Current Directory issue. Current Directory: {Environment.CurrentDirectory}"); //TODO: the line below can be removed when the bug with InProcess method is fixed (more details, follow the class definition and read the comments) CurrentDirectoryHelpers.SetCurrentDirectory(); logger.LogWarning($"Fix applied. Current Directory now is: {Environment.CurrentDirectory}");
Applying the fix as such still produces the same result.
The Application starts fine if running as OutOfProcess and if running under IIS Express

Can anyone help me with this, please?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

githubgitgit picture githubgitgit  ·  3Comments

markrendle picture markrendle  ·  3Comments

groogiam picture groogiam  ·  3Comments

FourLeafClover picture FourLeafClover  ·  3Comments

guardrex picture guardrex  ·  3Comments