I'm trying to upgrade an existing app from 2.1 to 2.2. Along with that I'm trying to upgrade the AspNetCore hosting module for IIS to AspNetCoreModuleV2
.
Here is what my web.config looks like at the moment:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<location path="." inheritInChildApplications="false">
<system.webServer>
<handlers>
<remove name="WebDAV" />
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" />
</handlers>
<aspNetCore processPath="dotnet" arguments=".\MyApp.dll"
stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout"
hostingModel="InProcess">
</aspNetCore>
<modules>
<remove name="WebDAVModule" />
</modules>
</system.webServer>
</location>
</configuration>
My AppPool and app were already setup from before using the AspNetCoreModule. The physical path for the app points to the root of the project, where the web.config lives:
C:\DEV\MyApp
Now I'm getting the following error when I visit my healthcheck:
HTTP Error 500.0 - ANCM In-Process Handler Load Failure
Common causes of this issue:
The specified version of Microsoft.NetCore.App or Microsoft.AspNetCore.App was not found.
The in process request handler, Microsoft.AspNetCore.Server.IIS, was not referenced in the application.
ANCM could not find dotnet.
Troubleshooting steps:
Check the system event log for error messages
Enable logging the application process' stdout messages
Attach a debugger to the application process and inspect
When I turn on stdout logging in the web.config the only thing I get is this:
Failed to initialize CoreCLR, HRESULT: 0x80131022
I'm wondering if it is looking for that dll in the physical path that the app is pointing to, instead of bin\Debug\netcoreapp2.2\MyApp.dll
?
If I change the arguments
to point to that full path, it still fails, I think because all that is in that dir are my own DLLs, and no web.config or system dependencies.
If I publish (i.e. dotnet publish
), it creates a publish
dir in the output dir, and then if I point the physical path to that dir, the page works, since it has all the bits it needs.
How am I supposed to set this up, so that I can simply build in VS and have the changes update, as well as publish cleanly using the same web.config?
Ideally I can just re-build, without having to publish. Not sure what I am doing wrong. Different help articles give different instructions.
More info:
dotnet --list-sdks
yields:2.1.509 [C:\Program Files\dotnet\sdk]
2.2.107 [C:\Program Files\dotnet\sdk]
2.2.109 [C:\Program Files\dotnet\sdk]
2.2.402 [C:\Program Files\dotnet\sdk]
dotnet --list-runtimes
yields:Microsoft.AspNetCore.All 2.1.13 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.2.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.13 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.2.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.13 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.2.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
UPDATE 1 It looks like VS 2017 isn't compiling some related .NET Standard/Core assemblies and including them in the output. I see this error in the ASNM logs:
Error:
An assembly specified in the application dependencies manifest (MyApp.deps.json) was not found:
package: 'AWS.Logger.Core', version: '1.5.1'
path: 'lib/netstandard2.0/AWS.Logger.Core.dll'
UPDATE 2 I was able to turn on more logging. See results below:
[aspnetcorev2.dll] Initializing logs for 'C:\Program Files\IIS\Asp.Net Core Module\V2\aspnetcorev2.dll'. Process Id: 17420.. File Version: 12.2.19225.7. Description: IIS ASP.NET Core Module V2. Commit: be0a4a7f4cf06cbd6ec714bd1d9afee6bdb040a8.
[aspnetcorev2.dll] Resolving hostfxr parameters for application: 'dotnet' arguments: 'exec .\MyApp.dll' path: 'C:\DEV\MyApp\'
[aspnetcorev2.dll] Known dotnet.exe location: ''
[aspnetcorev2.dll] Process path 'dotnet.exe' is dotnet, treating application as portable
[aspnetcorev2.dll] Resolving absolute path to dotnet.exe from 'dotnet.exe'
[aspnetcorev2.dll] Invoking where.exe to find dotnet.exe
[aspnetcorev2.dll] where.exe invocation returned: 'C:\Program Files (x86)\dotnet\dotnet.exe
C:\Program Files\dotnet\dotnet.exe
'
[aspnetcorev2.dll] Current process bitness type detected as isX64=1
[aspnetcorev2.dll] Processing entry 'C:\Program Files (x86)\dotnet\dotnet.exe'
[aspnetcorev2.dll] Binary type 0
[aspnetcorev2.dll] Processing entry 'C:\Program Files\dotnet\dotnet.exe'
[aspnetcorev2.dll] Binary type 6
[aspnetcorev2.dll] Found dotnet.exe via where.exe invocation at 'C:\Program Files\dotnet\dotnet.exe'
[aspnetcorev2.dll] Resolving absolute path to hostfxr.dll from 'C:\Program Files\dotnet\dotnet.exe'
[aspnetcorev2.dll] hostfxr.dll located at 'C:\Program Files\dotnet\host\fxr\2.2.7\hostfxr.dll'
[aspnetcorev2.dll] Converted argument '.\MyApp.dll' to 'C:\DEV\MyApp\MyApp.dll'
[aspnetcorev2.dll] Parsed hostfxr options: dotnet location: 'C:\Program Files\dotnet\dotnet.exe' hostfxr path: 'C:\Program Files\dotnet\host\fxr\2.2.7\hostfxr.dll' arguments:
[aspnetcorev2.dll] Argument[0] = 'C:\Program Files\dotnet\dotnet.exe'
[aspnetcorev2.dll] Argument[1] = 'exec'
[aspnetcorev2.dll] Argument[2] = 'C:\DEV\MyApp\MyApp.dll'
[aspnetcorev2.dll] Event Log: 'Invoking hostfxr to find the inprocess request handler failed without finding any native dependencies. This most likely means the app is misconfigured, please check the versions of Microsoft.NetCore.App and Microsoft.AspNetCore.App that are targeted by the application and are installed on the machine.'
End Event Log Message.
[aspnetcorev2.dll] Failed HRESULT returned: 0x8000ffff at d:\b\w\da744fbcc13abce\src\servers\iis\aspnetcoremodulev2\aspnetcore\handlerresolver.cpp:80
[aspnetcorev2.dll] Event Log: 'Could not find inprocess request handler. Captured output from invoking hostfxr: Error:
An assembly specified in the application dependencies manifest (MyApp.deps.json) was not found:
package: 'AWS.Logger.Core', version: '1.5.1'
path: 'lib/netstandard2.0/AWS.Logger.Core.dll'
'
End Event Log Message.
[aspnetcorev2.dll] Failed HRESULT returned: 0x8000ffff at d:\b\w\da744fbcc13abce\src\servers\iis\aspnetcoremodulev2\aspnetcore\handlerresolver.cpp:153
[aspnetcorev2.dll] Failed HRESULT returned: 0x8000ffff at d:\b\w\da744fbcc13abce\src\servers\iis\aspnetcoremodulev2\aspnetcore\applicationinfo.cpp:136
[aspnetcorev2.dll] Failed HRESULT returned: 0x8000ffff at d:\b\w\da744fbcc13abce\src\servers\iis\aspnetcoremodulev2\aspnetcore\applicationinfo.cpp:91
[aspnetcorev2.dll] Event Log: 'Failed to start application '/LM/W3SVC/1/ROOT/myapp', ErrorCode '0x8000ffff'.'
End Event Log Message.
UPDATE 3 I seem to get further if I delete my previously manually-created app pool and site, and then let Visual Studio create it for me when I build. It must be setting up some extra permissions to get to the directory where the nuget packages reside
So it appears that this can be caused it the App Pool is using the ApplicationPoolIdentity, and it doesn't have access to the nuget packages it needs.
That user (IIS AppPool\APP_POOL_NAME
) needs to be given access to the following directories:
C:\Users\YOUR_USER\.nuget\packages
(read only)C:\Windows\TEMP
Some of this is documented here:
There may be more paths required. I'm not sure what VS is doing when it auto-provisions the app pool for you in IIS. If I figure that out I will post it here.
Alternatively, change the identity of the App Pool to something like LocalSystem
, or a user that has the necessary permissions. This was the easier path for me.
User contributions licensed under CC BY-SA 3.0