Team XSockets.NET

Azure Worker Role

It is really easy to setup deploy your XSockets solution to a Azure Worker Role.

Pre Req

You have to have the Azure SDK installed

Create the project

Select a new Cloud project and choose worker role

cloud service

I renamed the worker role to XSocketsWorker

worker role

Install XSockets

Install the XSockets package from nuget

Install-Package XSockets

Add the template for worker role startup

Add a new item from the XSockets.NET 5 templates and select the AzureWorkerRoleConfig

item template

Worker Setup

First of all add a new field to the WorkerRole class to hold the IXSocketServerContainer.

private IXSocketServerContainer container;

Then add these lines in the OnStart method

container = Composable.GetExport<IXSocketServerContainer>();                                   
container.StartOnAzure();

Configuration

To be able to start the XSockets server in the worker role we have to add some configurations.

Replace the "marked" part with the name of your cloudservice so that you have "nameOfYourService.cloudapp.net"

Also add a new endpoint to decide what port to use, I choose port 8080

endpoint

Deploy

Now just deploy the service to Azure where the name of the service should match your configuration. Remember to reference any assemblies you have with XSockets modules as well as adding the license as shown under "The Basics/Add the license".

results matching ""

    No results matching ""