自动重新连接Blazor服务器端

编程入门 行业动态 更新时间:2024-10-28 17:22:59
本文介绍了自动重新连接Blazor服务器端的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

Blazor服务器端(dotnet核心3.1)

Blazor serverside (dotnet core 3.1)

我遇到了这样的问题:在客户端显示:

I run into the problem that on customer side this is shown:

无法重新连接到服务器. 重新加载页面以恢复功能.

Could not reconnect to the server. Reload the page to restore functionality.

每次更新代码库或Internet损坏或类似情况时.

Each time I update the Codebase or Internet is broken or something like this.

现在的目标是,一旦服务器再次返回(或间隔一定时间),它应该重新加载页面.

Now the goal is that it should reload the page as soon as the server is back again (or in some interval).

有没有可能/github repo或类似的东西可以帮助我?

Is there any possibility / github repo or something like this that could help me?

谢谢!

推荐答案

您可以尝试以下代码:

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

更多推荐

自动重新连接Blazor服务器端

本文发布于:2023-11-14 13:02:31,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1587279.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:服务器端   Blazor

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!