ASP.NET SignalR is Microsoft's new library for adding real-time functionality to applications. You can host ASP.NET applications with SignalR on Windows Server 2012 and IIS 8 (this setup provides full HTML 5 WebSocket API support for real-time functionality), or you can host on previous versions of Windows Server and IIS. Previous server versions do not offer websockets support, instead they use fallback transport mechanisms such as forever frames, server-sent events, and Ajax long polling. For more information, see SignalR Transports. Because previous server versions use fallback transport mechanisms, hosting on a previous server platform requires a few extra steps to get your SignalR application working in all browsers.
This posts pulls together several related steps that it takes to get a SignalR application working on a common previous-version hosting scenario: Windows 2008r2 and IIS 7.5. You can see a listing of these and other steps for working with SignalR applications on the SignalR Wiki FAQ page. The application sample used to test the steps in this post is from the tutorial Getting Started with SignalR. Instead of building the sample on .NET Framework 4.5 (as in the tutorial), I built it on .NET Framework 4, a common hosting scenario on IIS 7.5.
Here's a summary of the required setup steps to host on Windows 2008r2 with IIS 7.5:
Update the Signalr Application's Web.config File
In your SignalR application's web.config file, add the RAMMFAR setting to enable running all managed modules for all requests. This setting was required to get the SignalR sample application running in on Windows 2008r2 and IIS 7.5 in all browsers.
<system.webServer> <modules runAllManagedModulesForAllRequests="true"> </modules></system.webServer>
Update the Web Page that Uses SignalR
In the application web page that uses SignalR to communicate with the server, add the following code.
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
Set up Windows Server 2008r2 and IIS 7.5
As noted, I built the sample SignalR application from the Getting Started with SignalR tutorial on .NET 4. This is a common hosting scenario on Windows 2008r2 and IIS 7.5. The server was a new default default installation of Windows Server 2008r2 and IIS 7.5.
After following the above setup steps, I was able to deploy the .NET Framework 4-based version of the Getting Started with SignalR sample to the server, and it worked perfectly in IE (versions 8, 9, and 10), Chrome, and Firefox even though it was using fallback transport methods (forever frames in IE, and server-sent events in the other browsers). The interesting thing for SignalR developers is that apart from the above steps, I didn't have to change a single line of the SignalR code anywhere in the application to make this work.
This is a simple case but shows that SignalR really does support "automatic fallback" to earlier transport mechanisms when websockets support is not available on the server.