asp.net - SignalR connection issues -


i'm getting issues signalr (1.1.2) trying create basic realtime chat setup , after spending week on (including trawling through signalr source) i'm sort of @ end of can try...

i have (i think) rather complicated signalr setup consisting of:

  • load balanced servers
  • redis message bus
  • two sites on each server (asp.net webforms vb.net desktop site , mvc3 c# mobile site)

each of sites includes hub of , other site, each page can send messages each site.

looking chrome inspector (in example on mobile site), hubs both loaded, negotiate step mobile successful connect attempt fails after 3 seconds error:

eventsource's response has mime type ("text/html") not "text/event-stream". aborting connection.

which of course our custom 500 error page after microsoft.owin.host.systemweb has thrown:

the connection id in incorrect format.

once happens, of time sort of weird loop continue throw hundreds of these errors , send off lots of pings followed longpolling connect

the solution works in development environment (single iis instance) moving load balanced test environment see errors.

i don't know if there's else can add may i'm happy add it.


i've added following web.config files on both sites:

<validation validateintegratedmodeconfiguration="false"/> <modules runallmanagedmodulesforallrequests="true"/> 

and

<add name="access-control-allow-origin" value="*"></add> <add name="access-control-allow-headers" value="content-type" /> 

the global.asax files have:

protected void application_start() {     arearegistration.registerallareas();      registerglobalfilters(globalfilters.filters);     registerroutes(routetable.routes);      redisscaleoutconfiguration redisconfig = new redisscaleoutconfiguration([redisip], [port], string.empty, "name");     redisconfig.database = 9;     globalhost.dependencyresolver.useredis(redisconfig); }  public static void registerroutes(routecollection routes) {     routes.ignoreroute("{resource}.axd/{*pathinfo}");     hubconfiguration hubconfig = new hubconfiguration();     hubconfig.enablecrossdomain = true;     hubconfig.enabledetailederrors = true;     routetable.routes.maphubs(hubconfig);      <snip> } 

the js code have along lines of:

    function setupsignalr() {         //set connections         webconnection = $.hubconnection(pageinfo.weburl);         mobconnection = $.hubconnection(pageinfo.moburl);          //get hubs web , mobile         webhub = webconnection.createhubproxies().messaginghub;         mobhub = mobconnection.createhubproxies().messaginghub;          //hook call functions         <snip>          //now, start up!         mobconnection.logging = true;         mobconnection.start().done(function() {             mobhub.server.joinconversation(pageinfo.conversationguid, "mobile").fail(function (error) { console.log('joinconversation mobile connection failed. error: ' + error); });             webconnection.start().done(function() {                 webhub.server.joinconversation(pageinfo.conversationguid, "mobile").fail(function (error) { console.log('joinconversation web connection failed. error: ' + error); });             });         });     } 

from signalr troubleshooting document:

"the connection id in incorrect format" or "the user identity cannot change during active signalr connection" error

this error may seen if authentication being used, , client logged out before connection stopped. solution stop signalr connection before logging client out.


Comments

Popular posts from this blog

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -