3
votes

I am having random issues getting SignalR to connect when using the windows azure service bus as a backplane. The problem debugging it is that it seems to happen randomly (without any code changes), but when it does happen it takes awhile before it goes away. I typically try closing visual studio, rebooting, switching to longpolling, closing iis express, or any number of things and can't pinpoint what seems to fix it. Perhaps it is an issue with the azure service itself.

I setup logs and this is what is coming back: SignalR.ServiceBusMessageBus Information: 0 : Subscribing to 5 topic(s) in the service bus... SignalR.ServiceBusMessageBus Error: 0 : Failed to create service bus subscription or topic : The token provider was unable to provide a security token while accessing 'https://x-sb.accesscontrol.windows.net/WRAPv0.9/'. Token provider returned message: 'The remote name could not be resolved: 'x-sb.accesscontrol.windows.net''.

I've read other posts with the same error but they do not seem to be related.

My SignalR configuration looks like so:

GlobalHost.DependencyResolver.UseServiceBus(connectionString, "MyTopic");
var userIdProvider = new UserIdProvider();
GlobalHost.DependencyResolver.Register(typeof(IUserIdProvider), () => userIdProvider);
app.MapSignalR();

When I switch to longPolling it works temporarily but then starts failing again. SignalR starts ignoring the longPolling setting and tries to use websockets anyway.

As soon as I remove the UseServiceBus everything works correctly, but with it, I get all sorts of issues with either it not connecting, or it trying to use websockets even though longPolling is specified (which causes it to fail).

1

1 Answers

0
votes

Check the configuration.

string connectionString = "(your connection string)"; var config = new ServiceBusScaleoutConfiguration(connectionString, "YourAppName") { TopicCount = 3, MaxQueueLength = 50 }; GlobalHost.DependencyResolver.UseServiceBus(config);

http://www.asp.net/signalr/overview/performance/signalr-performance#scaleout_metrics