SignalR "Transport cannot be successfully initialized. Try to specify ..." when using UseSqlServer

I use

GlobalHost.DependencyResolver.UseSqlServer(ConfigurationManager.AppSettings["ConnectionString"]); 

to install the SQL backplane for a web application that uses signalR (version 2.2.1). The web application is hosted on several servers and on several sites in production. Each site has its own database.

This works fine on most servers (signalR connections and message flows between clients, as expected).

However, for some sites, signalR fails to connect, and the following message appears in the fail () callback handler (on the javascript client side):

"The transport cannot be successfully initialized. Try to specify a different transport or not use it at all for automatic initialization."

When client-side logging is enabled, it shows that signalR cannot connect using any protocol.

Signal R: Fail-safe vehicles exhausted.

The only difference between production sites and non-production sites is the database connection string. When debugging locally (on my dev machine) against a production database, I see the same behavior. Therefore, I thought the problem was with SignalR tables in db, but when writing a production database and restoring it locally, the problem does not exist. The connection string is identical for all websites except the db name.

I cannot understand why signalR will not connect to multiple sites (2 of 30 ~) - the only difference is in the database. If I comment / disable the UseSqlServer configuration, it works, but synchronization is not enabled.

Any suggestions on how to solve this problem are welcome. I saw messages related to the inability to connect signalR, and the proposed solution was related to the implementation of Application_PreSendRequestHeaders in global.asax. However, this is not a problem in this case.

+5
source share

Source: https://habr.com/ru/post/1264032/


All Articles