ninject - SignalR initial connection very slow on page refresh (delay on OnDisconnected) -
I'm using Signal R for a while in my MVC5 project, but only in the recent weeks, had to face. / P>
Every time I refresh a page or navigate to a different page inside my project, it takes a long time (between 3-8 seconds) to establish a new connection. [09:18:12 GMT + 0100 (GMT Daylight Time)] SignalR: SSE Endpoint 'http: // localhost: 53516 / signalr / connect? Transport = serverSentEvents and connectioÃÆ'à ¢ â,¬Å¡Ãƒâ € šÃ, · Attempt to connect to 22notehub% 22% 7D% 2C% 7B% 22name% 22% 3a% 22retailpriceindexhub% 22% 7 Day% 5D & amp; TID = 6 '. Jquery.signalR-2.0.3.min.js: 8 [09:18:18 GMT + 0100 (GMT Daylight Time)] SignalR: EventSource Connect. Although I do not use them in general, I have created those override methods for one of my hubs on the server, to see when breakpoints are being killed. :
public override task on-connected () {var connectionId = Context.ConnectionId; Return basis.onconnect (); } Public Override Task on Reconnect () {var connectionId = Context.ConnectionId; Return base On Reconnect (); } Public override task on disconnected () {var connectionId = Context.ConnectionId; Return basis On disconnected (); } This confirms that the page is not immediately called ondisconnected method immediately, but after the above mentioned delay. Once it hits, then it is immediately connected to it and everything goes smoothly from that point.
In the beginning I thought it was similar: but:
- Issue it with a chrome (version 31.0.1650.57); I'm on version 34.0.1847.116 meters
- My problem affects all browsers (slightly faster than IE Chrome or Firefox)
- According to that issue, only from project to online Navigating to the second page is delayed - In my case, ondacted
When I open a new tab, the connection is made immatilize:
[09:31:26 GMT + 0100 (GMT Daylight Time)] Signal R: SSE endpoint 'http: // localhost: 53516 / signalr / connect? Transport = serverSentEvents and connectioÃÆ'à ¢ â,¬Å¡Ãƒâ € šÃ, · Attempt to connect to 22notehub% 22% 7D% 2C% 7B% 22name% 22% 3a% 22retailpriceindexhub% 22% 7 Day% 5D & amp; TID = 6 '. Jquery.signalR-2.0.3.min.js: 8 [09:31:26 GMT + 0100 (GMT Daylight Time)] Signal R: Event Source Connect. This proves to me that the delay is anywhere between $. Linking connection.hub.start () and anonymous connection to the server, but I do not know how to detect it.
I have enabled server-side logging by modifying the Web.config file, but I do not see anything clearly in logs.
In addition, I have tried to change the transport method for a long time, but this issue still exists.
The same issued AVG or proxy mentioned on the Signal R. Geethb page has been mentioned, but none of these is relevant in my case.
I have a SignalR package (server and client) as well as Newton Soft. Jason has no use for the latest version.
The issue was resolved by changing Ninja Skoping for my DBFC & T and UnitOffer binding. I did not include that part of the code in my question, because I did not know where this issue was.
Originally, I was using the Inquisition Scope. After the change of InThreadScope, the problem disappeared with a slow connection, though I would go back to more problems with DBCETact lifestyle.
InCallScope from Ninject.Extensions.NationalScope is ideal for my needs.
bind & lt; IDbFactory & gt; () & Lt ;. DbFactory & gt; () InCallScope (); Bind & lt; IUnitOfWork & gt; () & Lt; UnitOfWork & gt; () InCallScope (); If someone can tell why the InRequestScope or default InTransientScope had such effect on SignalR performance (initial connection) in my project, then accepting it as a reply would be happy.
Comments
Post a Comment