Fehlermeldung "It was not possible to find any installed .NET Core SDKs" lösen

Fehlerbeschreibung

Im Ereignisprotokoll standen für eine .NET-Core-3.1-Webanwendung folgende Einträge:

Unable to locate application dependencies. Ensure that the versions of Microsoft.NetCore.App and Microsoft.AspNetCore.App targeted by the application are installed.

und

Could not find ‚aspnetcorev2_inprocess.dll‘. Exception message:
It was not possible to find any installed .NET Core SDKs
Did you mean to run .NET Core SDK commands? Install a .NET Core SDK from:
.NET Downloads (Linux, macOS, and Windows)

sowie

Failed to start application ‚/LM/W3SVC/2/ROOT/MyApplication‘, ErrorCode ‚0x8000ffff‘.

Ich hatte zunächst so etwas wie auf Stack Overflow beschrieben erwartet, konnte damit jedoch keine Ursache finden:

Ursache

Nach längerem Suchen konnte ich die „web.config“-Datei als Ursache ausmachen.

Dort stand u. a. drin:

<aspNetCore 
    processPath="dotnet" 
    arguments=".\Web.dll" stdoutLogEnabled="true" 
    stdoutLogFile="C:\LogFiles\stdout\MyApplication" 
    hostingModel="InProcess" />

Und genau das war die Ursache. Es gab in diesem Projekt keine „Web.dll“-Datei.

Der Fehler war durch das Kopieren der „web.config“-Datei aus einem anderen Projekt entstanden.

Lösung

Zur Lösung ganz einfach das Argument auf die korrekte DLL setzen.

In meinem Fall war das so etwas wie:

<aspNetCore 
    processPath="dotnet" 
    arguments=".\MyApplication.dll" 
    stdoutLogEnabled="true" 
    stdoutLogFile="C:\LogFiles\stdout\MyApplication" 
    hostingModel="InProcess" />

Anschließend lief die Anwendung wie erwartet.