0

I am hosting a Blazor Application and the web api on the same server but on tablet browsers it keeps give the users this message An error has occurred. This application may no longer respond until reloaded. Reload so please how I can know what is the problem exactly and how to avoid it. I search in internet and found some said I have to write in _Host.cshtml but the problem still exist.

 <script src="_framework/blazor.server.js"></script>
    <script>
        Blazor.defaultReconnectionHandler._reconnectCallback = function (d) {
            document.location.reload();
        }
    </script> 
Hani
  • 1
  • 1
  • 2

1 Answers1

1

In blazor server, every unhandled exception causes the connection to disconnect. This error is a generic message telling you that there was some problem in your server side code. To see what caused this, open developer tools in the browser and click on 'console' tab. There you will see the actual exception that has caused this exception.

Mayur Ekbote
  • 1,700
  • 1
  • 11
  • 14
  • Mayur Ekbote it's on mobile browser how can I see the developer tools in tablet browser it's so difficult to see the error on tablet. is there any way to send the error to log file or any other method.thanks – Hani Oct 11 '21 at 07:14
  • Why don't you open it on a laptop/desktop, see the error, fix it and then check on the mobile browser? – Mayur Ekbote Oct 11 '21 at 07:16
  • You can write all exceptions in a log file from the server side, if that is what you want. – Mayur Ekbote Oct 11 '21 at 07:19
  • Mayur Ekbote yes how to write all exceptioin in log I don't know where is the error exactly? the problem doesn't exist in pc or laptop. – Hani Oct 11 '21 at 07:42
  • That is a little circuitous. If you are new to Blazor, I suggest you skip that. Coming back to your problem, you might want to try this out: https://stackoverflow.com/questions/37256331/is-it-possible-to-open-developer-tools-console-in-chrome-on-android-phone – Mayur Ekbote Oct 11 '21 at 07:47
  • Dear Mayur Ekbote can you please guide me how to write all exceptions. – Hani Oct 11 '21 at 08:06
  • https://learn.microsoft.com/en-us/aspnet/core/blazor/fundamentals/logging?view=aspnetcore-5.0&pivots=server – Mayur Ekbote Oct 11 '21 at 08:10