1

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.

enter image description here

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.

enter image description here

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?

Jonathan Wood
  • 65,341
  • 71
  • 269
  • 466
  • Have you tried debugging it? – JuanR Oct 20 '22 at 22:02
  • @JuanR: I'm not sure I know how to debug remotely. – Jonathan Wood Oct 21 '22 at 00:13
  • You can use [failed request tracking](https://learn.microsoft.com/en-us/iis/troubleshoot/using-failed-request-tracing/troubleshooting-failed-requests-using-tracing-in-iis) to view detailed error information. – samwu Oct 21 '22 at 05:50
  • Are you compiling for Any CPU, 32 bit or 64 bit? Try compiling for 64 bit, see if that solves your issue. – JuanR Oct 21 '22 at 13:54
  • @JuanR: Do'h! Yes, this was the issue. Setting it to x64 solved the issue! Many thanks! – Jonathan Wood Oct 21 '22 at 14:56
  • @JonathanWood great. Happy to help. I will post an answer. I would appreciate it if you mark it as accepted. – JuanR Oct 21 '22 at 15:36
  • You omitted how you generated the binaries (the parameters set for `dotnet publish`). If switching application pool bitness resolves the issue, then you were publishing the binaries in the self-contained deployment approach that ties to a certain bitness. Tools like Jexus Manager can detect such issues automatically https://docs.jexusmanager.com/tutorials/ancm-diagnostics.html – Lex Li Oct 21 '22 at 15:58

1 Answers1

1

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.

Jonathan Wood
  • 65,341
  • 71
  • 269
  • 466
JuanR
  • 7,405
  • 1
  • 19
  • 30