0

After 3 days, this problem's doin' my head in.

SignalR is not creating its backplane SQL schema and tables in my pre-prod environment containing a single SQL server + load balanced web servers.

I've checked

  • WebSockets are installed in IIS
  • DB access allows table and schema creation
  • .Net 4.5 is installed and is being used
  • Recommended updates are installed
  • The steps listed here are complete (with the exception of doing the deployment from Visual Studio - I use MSBUILD to package and then use WebDeploy)

I've piggy backed the SignalR tracing. Only my trace entries are written - nothing from SignalR.

Everything works (including tracing) in my development environment if I build in Release mode.

Here's my tracing-enhanced start-up process

//Step 1: Check tracing works
var trace = GlobalHost.TraceManager["TestTrace"];
trace.TraceInformation("Preparing to start SignalR");

//Step 2: Check DB access rights
var connectionString = ConfigurationManager.ConnectionStrings["SignalR"].ConnectionString;
var schema = Guid.NewGuid().ToString("N");
using (var sqlConn = new System.Data.SqlClient.SqlConnection(connectionString))
{
    using (var sqlCmd = new System.Data.SqlClient.SqlCommand())
    {
        sqlConn.Open();
        sqlCmd.Connection = sqlConn;
        sqlCmd.CommandText = String.Format("CREATE SCHEMA [{0}]", schema);
        sqlCmd.ExecuteNonQuery();
        sqlCmd.CommandText = String.Format("SELECT '{0}' AS [Value] INTO [{1}].[ConnectionString]", connectionString, schema);
        sqlCmd.ExecuteNonQuery();
    }
}

//Step 3: Initialise SignalR
GlobalHost.DependencyResolver.UseSqlServer(connectionString);
app.MapSignalR(); //This is meant to trigger lots of logging.

//Step 4: Confirm we've successfully passed SignalR start-up
trace.TraceInformation("Finished starting SignalR");

Any help would be great. Cheers.

Rob
  • 141
  • 1
  • 9

1 Answers1

0

Problem wasn't in the server-side SignalR but in the client-side JavaScript's start-up routine aborting before connecting to the SignalR Hub.

It seems that SignalR doesn't start logging until the first connection is made.

For some reason (as yet unidentified) the SignalR start-up routine was completing in the development environment and aborting in the pre-production code. A possible cause is a different sequence of start-up events when using compressed JavaScript.

Rob
  • 141
  • 1
  • 9
  • I fixed the JavaScript bug (of my own making) in the client-side JavaScript. Once that was fixed the SignalR start-up code executed perfectly. – Rob Jan 21 '16 at 04:13