I'm trying to publish an asp.net core v3 app to run under IIS. I created a virtual directory, converted to application. It has it's own IIS app pool that is setup with CLR: No Managed Code, 32 bit:False, and Pipeline:Integrated. Publishing the app to the directory, in creates the default web.config and needed json files as expected. Web.config:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<location path="." inheritInChildApplications="false">
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet" arguments=".\PatientPlace3.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="inprocess" />
</system.webServer>
</location>
</configuration>
If I go to my website's physical directory and manually run "dotnet .\myapp.dll", I can run it at port 5001 no problem. My client-app and api calls all work fine. When I try go to the URL under IIS, I get a 503 error, and in the event viewer:
Unable to locate application dependencies. Ensure that the versions of Microsoft.NetCore.App and Microsoft.AspNetCore.App targeted by the application are installed.
then
Could not find 'aspnetcorev2_inprocess.dll'. Exception message: Could not execute because the specified command or file was not found. Possible reasons for this include: * You misspelled a built-in dotnet command. * You intended to execute a .NET Core program, but dotnet-.\PatientPlace3.dll does not exist. * You intended to run a global tool, but a dotnet-prefixed executable with this name could not be found on the PATH.
Another clue is that the first time I go to the url, IIS starts up a w3wp process for the DefaultAppPool, not my custom CORE one. I have aspnetcorev2_inprocess.dll in all of the Program FIles\dotnet\shared[frameworkname][version] directories (2.1.8 through 3.0.0), and have the modules installed. I've tried copying that dll into my app directory, and fully qualifying the dotnet argument.
Always the same error.
Recreating my AppPool fixed the problem. It is identical to the non-working AppPool, so it must be an order of creation issue. The first AppPool was installed before the v3 version of aspnet core module, or something like that. Thanks Lex.
Silly cause that leads to the same error: specifying an incorrect startup assembly (dll) in the web.config file:
<aspNetCore processPath="dotnet" arguments=".\not_to_be_found.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="inprocess" />
This might happen if web.config is not refreshed when publishing and the assembly name has changed.
I had this error. I looked at the event log errors. It said
Could not find 'aspnetcorev2_inprocess.dll'. Exception message: It was not possible to find any compatible framework version The framework 'Microsoft.AspNetCore.App', version '5.0.0' was not found. - The following frameworks were found: 2.1.19
so I downloaded and installed version 5 of ASP.NET Core Runtime from
https://versionsof.net/core/5.0/5.0.5/
also did a iisreset
just to be sure it gets fixed...
and it started to work.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With