[英]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,我们有一个配置设置:
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'
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.