Error
I just created a new Razor Pages website. It's simple and only has a couple of page. But the site is failing with the following message.
Event Viewer
I see the event viewer is reporting errors.
Application '/LM/W3SVC/7/ROOT' with physical root 'C:\inetpub\wwwroot\scwebgroup.com' hit unexpected managed exception, exception code = '0xe0434352'. Please check the stderr logs for more information.
Application '/LM/W3SVC/7/ROOT' with physical root 'C:\inetpub\wwwroot\scwebgroup.com' failed to load coreclr. Exception message: CLR worker thread exited prematurely
Error Logging
I set stdoutLogEnabled
to true in 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=".\SCWebGroup.exe" stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout" hostingModel="inprocess" />
</system.webServer>
</location>
</configuration>
<!--ProjectGuid: 43bcc2f4-878c-4b9a-903b-16d6bf867dc5-->
But I can find no log folder or any log files.
Running from the Command Line
I read you can try running the application from the command line and any errors might be shown, so I tried that. But when I ran the application, no errors were reported. It appeared to run correctly.
Target Version of .NET
My app is targeting .NET 6.0 and I have other applications that target .NET 6.0 on this same server. So I know this version of .NET is installed.
Summary
The application runs fine when I run it within Visual Studio.
The new application does not access any database.
I'm out of ideas. Can anyone offer other things to try here?
CodePudding user response:
When deploying, be sure to set the correct Target Runtime. If you are running on Windows Server, this will likely be win-x64.
If you get this wrong, the application will fail to load, and will give errors similar to what you're reporting.