【问题标题】:Blazor in Azure: The list of component records is not validAzure 中的 Blazor:组件记录列表无效
【发布时间】:2019-12-16 20:07:56
【问题描述】:

将我们的 blazor 应用部署到 azure 时,五分之四的失败并出现此错误(复制自 chrome 开发工具):

[2019-12-16T11:12:55.214Z] Information: Normalizing '_blazor' to 'https://example.com/_blazor'.
[2019-12-16T11:12:55.470Z] Information: WebSocket connected to wss://example-web-signalr-service.service.signalr.net/client/?hub=componenthub&asrs.op=%2F_blazor&negotiateVersion=1&asrs_request_id=...&id=...&access_token=...
[2019-12-16T11:12:55.548Z] Error: The list of component records is not valid.
    e.log @ blazor.server.js:15
    C @ blazor.server.js:8
    (anonymous) @ blazor.server.js:8
    (anonymous) @ blazor.server.js:1
    e.invokeClientMethod @ blazor.server.js:1
    e.processIncomingData @ blazor.server.js:1
    connection.onreceive @ blazor.server.js:1
    i.onmessage @ blazor.server.js:1
[2019-12-16T11:12:55.552Z] Information: Connection disconnected.
Uncaught (in promise) Error: Invocation canceled due to the underlying connection being closed.
    at e.connectionClosed (blazor.server.js:1)
    at e.connection.onclose (blazor.server.js:1)
    at e.stopConnection (blazor.server.js:1)
    at e.transport.onclose (blazor.server.js:1)
    at e.close (blazor.server.js:1)
    at e.stop (blazor.server.js:1)
    at e.<anonymous> (blazor.server.js:1)
    at blazor.server.js:1
    at Object.next (blazor.server.js:1)
    at a (blazor.server.js:1)

我们对此毫无意义。 blazor 失败的原因可能是什么?为什么它不会在我们的本地开发人员机器上失败?在 google 中很难找到任何关于此的内容。

如果我需要提供更多信息,请告诉我。我不确定哪个代码 sn-ps 可能是有用的信息。

【问题讨论】:

  • 我会删除 SignalR 服务并在 Azure 中打开 Web 套接字。我这样做完全没有问题。
  • 我打开了 Web Sockets 和 ARR,但仍然收到相同的错误消息?在我的开发机器上本地运行良好,一旦我部署到 Azure,我就会收到此错误

标签: azure .net-core azure-web-app-service blazor blazor-server-side


【解决方案1】:

试试这个:

services.AddSignalR().AddAzureSignalR(options =>
{
    options.ServerStickyMode = Microsoft.Azure.SignalR.ServerStickyMode.Required;
});

【讨论】:

  • 完美。 “使用 SignalR 服务时典型的连接流程是客户端首先与应用服务器协商获取 SignalR 服务的 url,然后服务将客户端路由到应用服务器。当您有多个应用服务器时,不能保证两台服务器(一个进行协商的人和获得集线器调用的人)将是同一个人。”该设置是为了使两台服务器相同,以便它们可以在协商和集线器调用之间共享一些状态。阅读更多:github.com/Azure/azure-signalr/blob/dev/docs/…
  • 谢谢,我最终在我的应用程序中使用了一个非常相似的解决方案。在我的应用程序中,我将此代码包装在 if (!HostingEnvironment.IsDevelopment()) { ... } 中,因为我只在生产/暂存中使用 Azure SignalR 服务,而不是在开发模式下。
猜你喜欢
  • 2020-05-24
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-05-26
  • 1970-01-01
相关资源
最近更新 更多