0

I am still unable to get my Blazor app to work. As suggested, I built a sample app to test with and see the same issues. Symptoms are pretty basic:

HTTP Error 503. The service is unavailable.

I have reviewed my App Pools and the associated identity, all is good. I have uninstalled and reinstalled the Web Server and reinstalled the Runtime Bundle. I have scoured the Event Log for errors and all I might see if I am lucky is a vague reference to an Unhealthy ISAPI process.

I have resolved all my DBCOntext lifetime issues, and the sample project does not even touch Entity Framework, it is the stock Blazor app you get when you create a fresh Blazor project.

I have tried to telnet into the app, it fails.

I can remove the entire folder contents and replace it with a default.htm file and see the file rendered if I browse to the site. If I put back the simple test app I get the 503 service unavailable error. I have been trying to get this app deployed for more than a week now with absolutely no success. How do I publish Blazor apps that work? What do I need to do to debug the app when it is not even making it to the page?

I have done all the things suggested in my initial post here. Nothing is working.

Previous Post on this Issue

  • Please try to install [URL Rewrite](https://www.iis.net/downloads/microsoft/url-rewrite), then check it again. – Jason Pan Mar 31 '23 at 13:46
  • I use URL Rewrite in the code... are you suggesting it also needs to be installed on the Server? I will give that a try. And it made no difference whatsoever, it crashed just like always after I installed the package and rebooted. What really makes this difficult is that I have no information about what is crashing the server. – BookTrakker Mar 31 '23 at 16:00

1 Answers1

0

It turned out that I needed to inject the DBContextFactory or pass it in as a parameter to static methods in order to create a usable DBContext. This allowed me to create a functional DBContext that did not crash the Web Server.

Something along these lines was mentioned, but not in a way that directly addressed this. One suggestion was that I needed to use this DBContextFactory, but it was only part of the answer. The full solution was to inject it and then pass it to any external static methods I needed. This eliminated the server crashing.

What really bothers me is that it took me about two weeks of beating my head against the wall to figure this out, as no errors provided any information that lead to the solution. Only by testing this did I figure it out.

Part of my original post was this very point. It has been decades since I have had to debug something like this, and it brought me back to the days of Pointer issues in C/C++.

  • Every kind of Web app should avoid static methods and especially static data. And of course you should inject the factory, everything is injected nowadays. You were pointed to the right pages showing exactly that. – H H Apr 05 '23 at 17:53
  • What remains is that your debugging and failure mode experience should have been much better. But we can't evaluate code that was never posted here. – H H Apr 05 '23 at 17:55
  • In the end I had to do exactly what you say I should not do. I have dependencies that are impossible to sort out, so I had to resort to using static methods. For example, I have an Account Manager that has to communicate with a Computer Manager that has to communicate with an App Manager, all of which have to communicate with each other. None of the patterns I have seen account for this. My solution required static methods where I pass in dependencies. I could not find any other way to solve this problem. – BookTrakker Apr 06 '23 at 18:56
  • What none of the pages showed me was that I needed to inject the factory, not the DBContext. I have found that the Real World is far more complex than some of these patterns seem to assume, and when that happens, I find they break down in terms of their intent. So I had to figure out how to solve the problem and this was the first time in a long time I had such little debugging data to work with. – BookTrakker Apr 06 '23 at 18:58