简体   繁体   English

Azure 中托管的 Blazor 应用未连接到 Azure SignalR 实例

[英]Blazor app hosted in Azure does not connect to Azure SignalR instance

We have a Blazor application hosted as an Azure Web App that doesn't seem to connect to the Azure SignalR instance, and instead creates a WebSocket connection to the Web App itself.我们有一个 Blazor 应用程序作为 Azure Web 应用程序托管,它似乎没有连接到 Azure SignalR 实例,而是创建了一个到 Web 应用程序本身的 WebSocket 连接。 But when running the app locally, it correctly connects to the SignalR instance.但是在本地运行应用程序时,它会正确连接到 SignalR 实例。

On the Azure web app:在 Azure Web 应用程序上:

天蓝色

Running locally:本地运行:

本地主机

For running locally, we have the connection string stored as a User Secret:为了在本地运行,我们将连接字符串存储为 User Secret:

"Azure:SignalR:ConnectionString": "Endpoint=https://<HOST>.service.signalr.net;AccessKey=<KEY>;Version=1.0;"

And for Azure, we have a configuration setting:对于 Azure,我们有一个配置设置:

AzureConfig

In code, we have:在代码中,我们有:

builder.Services.AddServerSideBlazor();
....
app.MapBlazorHub();

What could be preventing the Azure app from using the SignalR service?是什么阻止了 Azure 应用使用 SignalR 服务?

UPDATE更新

Interestingly, when we publish manually from within Visual Studio, adding SignalR as a service dependency, it works correctly.有趣的是,当我们从 Visual Studio 中手动发布,将 SignalR 添加为服务依赖项时,它可以正常工作。 However, when deploying via our CI server (Azure DevOps) it reverts back to not using the SignalR service.但是,当通过我们的 CI 服务器 (Azure DevOps) 进行部署时,它会恢复为不使用 SignalR 服务。

We have looked at the app config in Azure and cannot see any differences - but it looks like something gets set when deploying manually from VS that doesn't get set when deploying from DevOps.我们查看了 Azure 中的应用程序配置,看不出有任何差异 - 但看起来从 VS 手动部署时设置了一些东西,而从 DevOps 部署时没有设置。 The deployment task looks like this:部署任务如下所示:

  - task: AzureRmWebAppDeployment@4
    displayName: 'Deploy to Azure App Service'
    condition: eq('${{ parameters.slot }}', '')
    inputs:
      ConnectionType: 'AzureRM'
      azureSubscription: '<SubName>'
      appType: 'webApp'
      WebAppName: '<AppName>'
      ResourceGroupName: '<RG>'
      packageForLinux: '$(System.ArtifactsDirectory)/drop/<App>.zip'   

Did you activate WebSocket on your Azure Web App?您是否在 Azure Web App 上激活了 WebSocket?

在此处输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Azure SignalR Blazor 应用程序未收到消息 - Azure SignalR Blazor app not receiving messages Azure Signalr + Azure函数+ wpf客户端-如何使用azure函数和自托管的Azure SignalR App创建wpf客户端应用程序 - Azure Signalr +Azure function + wpf client - how to have a wpf client application using azure funtion and self hosted Azure SignalR App 部署托管到 Azure 的 Blazor WebAssembly 应用 ASP.NET Core - Deploy Blazor WebAssembly App ASP.NET Core hosted to Azure 无法连接到Azure SignalR集线器 - Could not connect to Azure SignalR Hub 将自托管的SignalR后端部署到Azure - Deploy a self-hosted SignalR backend to Azure Blazor C# App如何连接到Azure Z9778840A0100CB30C982876741B0数据库? 苹果系统 - How to connect Blazor C# App to Azure SQL Database? MacOS Blazor WA 托管 - 401 在 Azure AppService 上未经授权 - Blazor WA hosted - 401 Unauthorized on Azure AppService 通过Windows Store应用连接到Azure托管的SQL DB - Connect to a SQL DB hosted on azure through a windows store app 如何在发布服务器项目而不是客户端的 Azure DevOps 上为 Blazor WebAssembly 托管应用程序创建构建管道? - How to create a build pipeline for Blazor WebAssembly Hosted app on Azure DevOps that publishes the server project not the client? 移动呈现不正确 Azure 应用服务 Blazor Webassembly(ASP.NET 托管) - Mobile Renders Incorrectly Azure App Service Blazor Webassembly (ASP.NET Hosted)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM