I launched an app programmed in .NET Core 6 and React.js (with Vite.js) with Visual Studio, using the VS publish option and selecting the option Self-contained. This app uses the framework .NET 6.
The computer where I programmed has installed several .NET, such as 6.0. When I launched the app in the server (Windows Server 2012 R2, IIS 8.5), and accessed the page (https://{server ip}/) the app gave the error above: "Handler "aspNetCore" has a bad module "AspNetCoreModuleV2" in its module list"
The server has not the .NET 6, but since the app is self-contained (win-x64) I didn't bother.
The dotnet --info
command (on the server) returns the existence of the following runtimes:
Microsoft.AspNetCore.All 2.1.15
Microsoft.AspNetCore.App 2.1.15
Microsoft.NETCore.App 2.1.15
When I openned the app page on Internet Explorer, it returned the following message:
HTTP Error 500.21 - Internal Server Error
Handler "aspNetCore" has a bad module "AspNetCoreModuleV2" in its module list
The app web.config
file (in the server app directory) contains:
<?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=".\FeriasForm.Server.exe" stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout" hostingModel="inprocess" />
</system.webServer>
</location>
</configuration>
<!--ProjectGuid: 81ac978b-0566-4aa3-a798-43b0df2b3600-->
Note: no log file was produced in the directory .\logs
.
If I run directly dotnet
:
C:\ITF\FeriasForm>dotnet FeriasForm.Server.exe
Error:
An assembly specified in the application dependencies manifest (FeriasForm.Ser
ver.deps.json) has already been found but with a different file extension:
package: 'FeriasForm.Server', version: '1.0.0'
path: 'FeriasForm.Server.dll'
previously found assembly: 'C:\ITF\FeriasForm\FeriasForm.Server.exe'
If I run dotnet
with the dll:
C:\ITF\FeriasForm>dotnet FeriasForm.Server.dll
info: Microsoft.Hosting.Lifetime[14]
Now listening on: http://localhost:5000
info: Microsoft.Hosting.Lifetime[0]
Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]
Hosting environment: Production
info: Microsoft.Hosting.Lifetime[0]
Content root path: C:\ITF\FeriasForm\
warn: Microsoft.AspNetCore.HttpsPolicy.HttpsRedirectionMiddleware[3]
Failed to determine the https port for redirect.
I note that my application has a DLL with the same name as the EXE, even though the AI assistant suggests that shouldn't happen. My FeriasForm.Server.deps.json reffers the library DLL...
The server has .NET Core 2. Is this compatible with a self-contained .NET 6 app? May I install the runtime on the server without disrupt the .NET Core 2?