Reputation: 67315
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.
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
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.
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.
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.
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?
Upvotes: 5
Views: 8817
Reputation: 590
On experiencing the same issue/error I found the cause to be an environment entry in the web.confg:
<environmentVariable name="APIDISCOVERY_FILEPATH" value="D:\MyApp\obj\Debug\net6.0\ApiEndpoints.json" />
The project had been upgraded to .net 8.0. Commented out this entry and the application runs fine in IIS again.
Upvotes: 1
Reputation: 13198
One thing to check is the AppPool. When making a new WebSite in IIS7, for example, it will default to a new v2 AppPool. Select probably your DefaultAppPool instead (v4).
Upvotes: 0
Reputation: 7803
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.
Upvotes: 7