Open vicancy opened 5 years ago
I'm trying to set up multiple service instances base on Resiliency and disaster recovery To test it, I deleted the primary service resource and experienced the mentioned issue. I implemented a workaround to resolve it. This solved my client side connection to the secondary/online signalr service. But when I try to invoke any method on the server side in the hub (connection.send("addtogroup", groupName)) I get an error:
Connection disconnected with error 'Error: Server returned an error on close: No app server is currently connected to the Azure service.
Question: Will fix for the endpoint status also solve the issue with the connection on the server side? Question: Should I create a separated issue for it? Question: Is there any better way to ping the service, w/o preview package?
Workaround: I used the preview package Azure SignalR Service Management SDK where I added my own router where I try if an endpoint is working:
private bool CheckEndpoint(string connectionString)
{
try
{
var _serviceManager = new ServiceManagerBuilder()
.WithOptions(option =>
{
option.ConnectionString = connectionString;
option.ServiceTransportType = ServiceTransportType.Transient;
}).Build();
IServiceHubContext _hubContext = _serviceManager.CreateHubContextAsync("Ping", null).ConfigureAwait(false).GetAwaiter().GetResult();
_hubContext.Clients.All.SendCoreAsync("ping", new object[0]).ConfigureAwait(false).GetAwaiter().GetResult();
return true;
}
catch (Exception ex)
{
Logger.LogError(ex, $"Error with negotiate endpoint: {connectionString}");
return false;
}
}
I'm using:
Hi @nikolasur
To test it, I deleted the primary service resource
As Resiliency and disaster recovery stated, the disaster recovery uses active-active
pattern, which means, for different regions, there are both "app server" -> "azure service" pairs. The connection between "app server" and "azure service" within one region should be always primary
, and connections cross region is secondary
in case disaster happens.
No app server is currently connected to the Azure service.
happens when there is no primary
connections connected.
Let's create an issue to discuss it if you still have any.
Hi @vicancy, Thank you for the response, for now there is no other issues/questions. I will set both endpoint as primary, and return the endpoint in same region by default in custom router.
/negotiate
request enumerates all the endpoint online status and creates a new array.