locked
SignalR stopped working after upgrading to Windows 2012 Standard Server RRS feed

  • Question

  • User-1842184943 posted

    Hi,

                  We are using SignalR in our application to receive updates from server. In current setup we have a Web API which receives notifications from other sources and based on this information this API gets data from database and pushes that data to a SignalR hub which is hosted in another WebAPI. We have AngularJS application which subscribes to the SignalR hub and receives data from this SignalR hub. This setup was hosted in Windows 2008 R2 environment and was working fine. Recently this environment got upgraded to 2012 Standard server and sending notifications to SignalR hub stopped working.  Both server-side Web API and JS client are able to establish connection to the SignalR hub but are unable to send any message to the SignalR hub. Its also not throwing any exception. We have WebSockets enabled on the IIS and .Net framework 4.5.2 is also installed. We just can't figure out what is missing from the new environment that the earlier working setup stopped working.

    Thanks in advance,

    Siddharth

    Wednesday, December 27, 2017 5:27 AM

All replies

  • User61956409 posted

    Hi Siddharth,<o:p></o:p><o:p> </o:p>

    As far as I know, the SignalR server component can be hosted in both Windows Server 2008 r2 and Windows Server 2012. You can check this article: “Supported Platforms” to know more about servers supported by SignalR.<o:p></o:p>

    Besides, you can try to enable SignalR tracing to view diagnostic information about events in your SignalR application, which can help troubleshoot issue.<o:p></o:p>

    With Regards, <o:p></o:p>

    Fei Han<o:p></o:p>

    Thursday, December 28, 2017 2:42 AM
  • User-1842184943 posted

    Hi Han,

                Thanks for the reply. As for the supported platform, it should work in the Windows 2012. We had also tried enabling SignalR tracing but didn't find anything there that could point us to the cause of the problem. We are just wondering if there is some configuration change from IIS 7.5 to IIS 8.5 which we have missed that caused it to stop working. In the other environment with same configuration(which is production environment), it has been observed that it works for 20-30 seconds after resetting IIS and then stops working again. Can there be some sort of configuration which is blocking it after a few hits, we can't be sure.

    Regards,

    Siddharth

    Thursday, December 28, 2017 4:50 AM
  • User61956409 posted

    Hi Siddharth,<o:p></o:p>

    <o:p>

    tried enabling SignalR tracing but didn't find anything there that could point us to the cause of the problem.
    </o:p>

    Do you check the connection and hub invocation events in your browser console? Any error message?<o:p></o:p>

    With Regards, <o:p></o:p>

    Fei Han<o:p></o:p>

    Friday, December 29, 2017 3:10 AM
  • User-1842184943 posted

    Hi Han,

                    I did not see any error messages in the browser console. I could see the events in browser console when the client received message from server and after some time (100-150 messages later) it stopped receiving events. I tried to call server methods from JS client which started giving messages like 'There was an error in sending message' but did not give any specific detail. I also tried having a thread in the Hub and send message to client repeatedly (one every second) which worked without any problem. I tested it for around 20 minutes. So it seems that sending message from Hub to client works OK but invoking a method on Hub from client stops working after a few messages.

    I tried a few more tests. I started an Interval in JS application to invoke server method on the SignalR hub with hitting Hub at 250 ms interval. This Hub method in turn sent message to the JS client. I tested it for approx 1.5 hours and it worked OK except for a few disconnects and reconnects at the client with [no reason given] as the disconnection reason.

    In the Web API we are using SimpleInjector to inject dependencies in the API controllers. The SignalR proxy is also injected into the API controller using same mechanism. I started a thread in the SinpleInjector Initializer class to send messages at 1 sec interval to the Hub and it worked fine from over 1 hour. SignalR Hub and the API controller are hosted in two separate Web API applications on same IIS and Website. It seems that the proxy that is injected in the API controller stops working after sometime and it didn't throw any exception either. This same setup was working fine in Server 2008 and stopped working in Server 2012 R2 standard. Is there an efficient way to use the SignalR connection/proxy in the API controller so that we can use same HubConnection/Proxy object for each request to the Web API as these requests are sent at high frequency and establishing a connection for each request will not be an efficient solution.

    Thanks,

    Siddharth

    Friday, December 29, 2017 4:59 AM
  • User-1842184943 posted

    New Updates:

    Someone from work suggested that Websockets works better with SSL so use some other transport medium while initializing connection from client to server. As Windows 2012/IIS 8.5 supports Websocket so it will be using Websocket by default. I changed the code to use ServerSentEvents as transport while initializing connection at client. The connection is still in-consistent. Sometimes it breaks after 30 minutes and sometimes it works for approx 4 hours. I have to reset the IIS to make it working again after the connection is broken.

    I have also made changes in code to handle the StateChange event of the connection and when the connection is going in Reconnecting state, stopping the connection and re-initializing the connection (by creating new connection object and calling start on it).

    Please suggest how to solve this issue as I have to reset the IIS manually after it stops working.

    Thanks,

    Siddharth

    Friday, January 5, 2018 8:05 AM