IIS InProcess Hosting - Debugging Errors #18325
I'm running into a problem with .NET Core 3.1 application that I'm hosting on IIS. I'm testing locally on my local machine and the application runs fine in out of process.
I have logging on and I get a trace log, but the failure is in the guts of the runtime without any hint why it's failing:
My code stops at the call to
builder .Build() <--- Last of my code .Run();
The Web.Config is simple and as I mentioned the app starts fine with OutOfProcess hosting:
<?xml version="1.0" encoding="utf-8"?> <configuration> <system.webServer> <!-- check the path to the dll - in Project the below works in a plain publish output use `.\WebConnectionWebServer.dll` --> <handlers> <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" /> </handlers> <aspNetCore processPath="dotnet" arguments="C:\WebConnection\WebConnectionWebServer\WebConnectionWebServer\bin\Publish\WebConnectionWebServer.dll" stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout" hostingModel="inprocess"> <environmentVariables> <environmentVariable name="ASPNETCORE_ENVIRONMENT" value="Production" /> <environmentVariable name="WEBCONNECTION_USELIVERELOAD" value="False" /> <environmentVariable name="WEBCONNECTION_OPENBROWSER" value="False" /> <environmentVariable name="WEBCONNECTION_SHOWURLS" value="False" /> </environmentVariables> </aspNetCore> </system.webServer> </configuration>
The IIS AppPool runs under System so permissions should not be a problem in this scenario. I'm loading the DLL (not an EXE which would be nice if it worked with a standalone Exe BTW).
I have no idea what else to look at to debug this. Based on the error message, this is getting into the IIS hosting bits of the builder and failing there, but there's not enough information for me to see anything beyond that.
Further technical details
@jkotalik Yup - that's totally it!
I thought wasn't referencing any of those dependencies directly as this application is very light on its dependencies, so it's using primarily the ASP.NET Framework reference.
However I noticed that when I built the DotnetTool nuget package was referencing the .NET Core 2.2 in process hosting dll which I thought was weird.
Sure enough checked my project and for reasons I don't remember I had a ref to:
<PackageReference Include="Microsoft.AspNetCore.Server.IIS" Version="2.2.6" />
Removed that and now InProcess hosting is working.
Thanks. I would have never figured that one out on my own.