1
votes

In my project SignalR is working fine. But due to introduction of load balancing in Web Farm, I am planning to use Backplane with SQL, following this article :http://www.asp.net/signalr/overview/performance/scaleout-with-sql-server .

Backplane works fine if I use the latest packages(version 2.2.0) for Microsoft.AspNet.SignalR and Microsoft.AspNet.SignalR.SqlServer and choose 4.5 .Net framework . However, for some reasons , I need to stick to .Net 4.0 version and NOT use Owin. When I install the packages of Microsoft.AspNet.SignalR and Microsoft.AspNet.SignalR.SqlServer with version 1.1.4 OR 1.2.2 and work with .Net 4.0 , the SignalR seems to work fine but Backplane(using SQL) does not seem to be kicking in , as there are no tables created in the database. If I enable tracing , there are no trace files. Only transport related trace file is getting generated. I am using below code in my global.asax.cs:

// Signalr connection string 
var signalRConnectionstring = ConfigurationManager.ConnectionStrings["SignalR"].ToString();
GlobalHost.DependencyResolver.UseSqlServer(signalRConnectionstring);

 // Register the default hubs route: ~/signalr
 RouteTable.Routes.MapHubs();
1
Signalr Core depented to owin so you can't remove it. Can you install first Install-Package Microsoft.Owin -Version 2.1.0 Then Install-Package Microsoft.Owin.Security -Version 2.1.0. Then install sql server.Erkan Demirel
Is there an error you are getting? Does the connection string have the right permissions? Can you connect manually to the sql server using your connection string?Matt Clark
@Erkan, Owin is not mandatory for SignalRPramod Sharma
@MattClark:Yes I manually tried the connection it is working. Please see my answer I could finally find the solutionPramod Sharma

1 Answers

2
votes

Finally I could find the solution. The error misled me in believing it was .Net 4.0 issue. There were no runtime exception thrown in my project, so debugging was not helping. When I statically analyzed the code, it turned out that the problem was with the dependency resolver of SQLServer for SignalR. Below line of global.asax was not getting resolved for dependency(and also was not throwing any exception)

GlobalHost.DependencyResolver.UseSqlServer(signalRConnectionstring);

This was because I am using Unity in my project.

The solution was simple , the SQLServer for SignalR had to be resolved after resolving SignalR, for which there is already one custom class in my project . I wish I had seen in this direction first, it would have saved lot of time .