Skip to content
davidfowl edited this page Dec 17, 2012 · 14 revisions

This article explains how to use the Windows Azure Service Bus backplane for SignalR.

## Setup ## ### Service Bus Setup ###

You'll need to create a Service Bus using the Windows Azure management portal.

### Setting up NuGet References ###

Install the SignalR libraries using NuGet:

Install-Package -pre Microsoft.AspNet.SignalR

Install the SignalR.WindowsAzureServiceBus package using NuGet:

Install-Package -pre Microsoft.AspNet.SignalR.ServiceBus

## Wiring Up the Windows Azure Service Bus Provider ## To wire up the service bus implementation, you'll need to add a little code to your App_Start or Global.asax.cs file. The use of a single extension method allows for the wire-up process, the signature of which is displayed below. ### Sample Global.asax.cs Usage ### The code below demonstrates how to wire up the Service Bus from within a C# Global.asax file. The values copied from the Windows Azure Service Bus administration dialogs has been pasted into the C# file.
using System;
using Microsoft.AspNet.SignalR;

namespace WindowsAzureServiceBusBackedSignalR
{
    public class Global : System.Web.HttpApplication
    {
        protected void Application_Start(object sender, EventArgs e)
        {
            string connectionString = "";                 
            GlobalHost.DependencyResolver.UseWindowsAzureServiceBus(connectionString, 1);  
        }
   }
}

Note, this web site is an ASP.NET site that runs in an Azure web role. As of 1.0alpha2 there are some bugs in AzureWebSites due to which ServiceBus Scale out scenarios do not work well. We are working on resolving this for the future

### What to Expect ### When the site runs and SignalR messages are transmitted, new topics will appear in the Windows Azure administration panel. Subscriptions also appear, that reflect the name of the client machine connecting to the Service Bus to use it in the SignalR transmission.

To increase the number of topics used by the Service Bus (and therefore increase throughput and performance), increase the numberOfTopics parameter. This will result in more topics being created in the Service Bus namespace.

Clone this wiki locally