Azure / azure-signalr

Azure SignalR Service SDK for .NET
https://aka.ms/signalr-service
MIT License
422 stars 100 forks source link

Frequent lost connections when Blazor Server deployed to Azure ContainerApps #1512

Open sravimohan opened 2 years ago

sravimohan commented 2 years ago

Describe the bug

Frequent connections issues when connecting from a Blazor Server App deployed to the new Azure ContainerApps. I am using Azure SignalR in standard mode.

[21:33:15 ERR] Failed to connect to '(Primary)https://****.service.signalr.net', will retry after the back off period. Error detail: The server returned status code '403' when status code '101' was expected.. The server returned status code '403' when status code '101' was expected.. Id: 6197cc98

To Reproduce

Exceptions (if any)

[21:33:15 ERR] Failed to connect to '(Primary)https://****.service.signalr.net', will retry after the back off period. Error detail: The server returned status code '403' when status code '101' was expected.. The server returned status code '403' when status code '101' was expected.. Id: 6197cc98

Further technical details

<PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="6.0.1" />
<PackageReference Include="Microsoft.Azure.SignalR" Version="1.13.0" />
Y-Sindo commented 2 years ago

Please confirm that your connection string is correct. Additionally, did the issue only occur in the Azure Container Apps or it could be reproduced locally?

sravimohan commented 2 years ago

Please confirm that your connection string is correct.

yes, can confirm. I am using primary connection string. Also it does work intermittently.

Additionally, did the issue only occur in the Azure Container Apps or it could be reproduced locally?

It seems to work locally and I am not seeing the "Failed to connect to" errors in my local logs.

Additional error logs, https://gist.github.com/sravimohan/d43f45f49a21db069944e035f3ecb417

Y-Sindo commented 2 years ago

This doc might help: Troubleshooting methods. You could also send your SignalR resource ID to zityang@microsoft.com for us to check backend log for you.

sravimohan commented 2 years ago

thank you, I will check out the troubleshooting methods. I will email the resource id to you.

Y-Sindo commented 2 years ago

yes, can confirm. I am using primary connection string. Also it does work intermittently.

From the logs in the back end, you should be using AAD auth instead of access key. Error code "403" means the app doesn't have the correct role. The strange thing was that 403 only occurred on one IP address. Please confirm all your app instances have the correct role. Hope these information helps you.