This content is archived. See latest version here

Last updated: Feb 23 2015

Configuring .NET SignalR

ASP.NET SignalR is a library for developing real-time web functionality easy, allowing for bi-directional communication between server and client. SignalR is used by some of the EPiServer add-ons, such as Live Monitor and Content Collaboration.

If you are getting errors about SignalR not being set up correctly when starting the EPiServer user interface in the JavaScript console, you might need to clear the .NET temporary files.

Configure SignalR as follows:

    1. If you are using Visual Studio 2012, ensure that .NET Framework 4.5.1 (or later) and the developer pack are installed.
    2. Open, for example, Alloy.csproj in Visual Studio and do the following:
       


      • Right-click the project and select Properties.
      • Change Target framework to .NET Framework 4.5.1 or later.
      • Save the project as solution, for example, Alloy.sln.
         
    3. Install the Microsoft.AspNet.SignalR package from NuGet.org, or go to Visual Studio > ToolsNuGet Package Manager > Package Manager Console, run the command
      Install-Package Microsoft.AspNet.SignalR -Version 2.0.3
    4. Open web.config and add the following lines:
      <configuration>
      ...
        <runtime>
          <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
          ...
            <dependentAssembly>
              <assemblyIdentity name="Microsoft.Owin" publicKeyToken="31bf3856ad364e35" culture="neutral" />
                <bindingRedirect oldVersion="0.0.0.0-2.0.999.999" newVersion="2.0.1.0" />
            </dependentAssembly>
            <dependentAssembly>
              <assemblyIdentity name="Microsoft.Owin.Security" publicKeyToken="31bf3856ad364e35" culture="neutral" />
                <bindingRedirect oldVersion="0.0.0.0-2.0.999.999" newVersion="2.0.1.0" />
            </dependentAssembly>
            <dependentAssembly>
              <assemblyIdentity name="Microsoft.AspNet.SignalR.Core" publicKeyToken="31bf3856ad364e35" culture="neutral" />
                <bindingRedirect oldVersion="0.0.0.0-2.0.3.0" newVersion="2.0.3.0" />
            </dependentAssembly>
          </assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
        </runtime>
      ...
      </configuration>

      newVersion will be the real version value of running assemblies on the website. For example, 2.0.1.0 for Microsoft.Owin, 2.0.3.0 for Microsoft.AspNet.SignalR.Core might not be running on your website.
    5. Also add the following line in web.config under appSettings:
      <add key="owin:AutomaticAppStartup" value="false" />
    6. Rebuild the solution and refresh the website. Ensure the website runs as normal.
    7. Log in to the website and go to Add-ons and install the Content Collaboration and Live Monitor add-ons.
    8. Restart the website.
    9. Open web.config again, and replace the following line under appSettings:
      <add key="owin:AutomaticAppStartup" value="false" /> to
      <add key="owin:appStartup" value="EPiServerContentCollaborationOWINStartup" />

      The example above shows configuration for Content Collaboration. For LiveMonitor, the startup value is EPiServerLiveMonitorOWINStartup.

Note that the OWIN startup needs a class. To set up a start-up class, see EPiServer and OWIN.

OWIN start up and optimizeCompilations

If the project previously did not have an Owin startup class and optimizeCompilations was enabled then sometimes the new code is never executed. This might result in various errors since the OWIN functionality is never set up. To work around this, temporarily set optimizeCompilations in web.config to false to clear the cache, start the site and then you can set optimizeCompilations to true again.  

Do you have feedback on this documentation? Send an email to documentation@episerver.com. For development-related questions and discussions, refer to our Forums on https://world.episerver.com/forum/