Reputation: 381
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.
Upvotes: 27
Views: 43114
Reputation: 1565
There is already one answer mentioning "Recreating the app pool". Since it was running already and I just exchanged some DLLs and got this issue, this could not be the problem. So in my case it was just a simple restarting of the app pool and everything worked fine again.
Upvotes: 0
Reputation: 867
My Event Viewer indicated "Could not find 'aspnetcorev2_inprocess.dll'." also.
I am working on an Asp.Net Core application (MVC) using .NET5 as target framework. In my case, it was that I did not included the runtimes libraries (I mean, the folders /runtimes/win, runtimes/win-x64, and so on). I also needed to go to my WebSite in the Internet Information Services (IIS) and give permissions to the IIS_USRS user.
Upvotes: 0
Reputation: 10444
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.
Upvotes: 3
Reputation: 23078
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.
Upvotes: 13
Reputation:
I tried everything. Including running the .EXE instead of dotnet + arguments (having the dll). IIS keeps on complaining about an invalid web.config. When switching to 64 bitness it will say: "Failed to find the RegisterModule entrypoint in the module DLL C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App\3.1.8\aspnetcorev2_inprocess.dll."
Finally I decided to abandon the IIS idea, and go for a docker container.
Upvotes: 0
Reputation: 381
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.
Upvotes: 11