First it time to upgrade to .net 8 as .net 7 is out of support. A 500 error is an a exception that’s not caught. You need to add better error logging to your application. Also as you are running under systemctl, what appears in the console log?
How to troubleshoot mysterious internal 500 server error of a Blazor App on Linux
An application has mysteriously stopped working on a build with internal 500 server error.
The application was working on a previous build that's only a day old. The changes between the builds are minimal.
The proxy settings on Apache are the same in the documentation for Blazor, and have worked just fine. It is highly unlikely that's the culprit.
The logs show that Microsoft's internal logging stops at "Hosting started", but I have a working service in the background in a separate thread, and the logs show that that is working just fine. This means the application is running, but something is wrong with Blazor's ability to serve pages.
I'm not sure what else to do. I'm at a loss of what my next steps are to try and figure out why it's breaking so spectacularly without a known cause or any indication as to why. I would really like help in this regard.
The process:
The Blazor App is on .NET 7 and build it targeting linux-x64
. dotnet build -c [my-config] -r linux-x64
, I then zip up the contents in the build and scp it over to the linux server. I then unzip the file and push the contents to the services directory where I stop the service using systemctl
, copy the contents over, archive the previous contents, and then start systemctl
again.
This process works well 99% of the time, but I've noticed that this can go very very wrong with this particular problem. It showed up once before, on a .NET 5 version of an app, so we opted to continue on with .NET 7 and not roll back, because .NET 7 was working just fine. However this spectacular level of breaking makes me extremely nervous. Computers are deterministic, so why on earth would an app that previously built fine, would seemingly out of the blue, break like this? Being able to get deeper into this problem and really troubleshoot it to figure out why would be very very helpful.