This sample demonstrates how to run a Windows Azure Service Bus client and service on Windows Azure.

This sample configure Service Bus programmatically. Only environment and security information is stored in the configuration files. Also, these samples package the Microsoft.ServiceBus.dll (note that Copy Local is set to True for the Assembly Reference setting).

Prerequisites

To run this sample on .Net Framework 4, you must install the Windows Azure SDK 1.5. You would also need the Windows Azure Tools for Visual Studio 1.5 for working with this sample in Visual Studio 2010. This sample works on the local developer fabric (included in the Windows Azure SDK) and also in the Windows Azure cloud service. To run the sample in the cloud service, you must also have a valid Windows Azure account. More information about Windows Azure can be found here: https://windows.azure.com. Please note that the Windows Azure SDK also has a number of its own pre-requisites (including IIS and SQL Express).

Running the Sample

You must start Visual Studio in elevated (administrator) mode. Right-click on Visual Studio and then click Run as Administrator. This is required by the Windows Azure simulation environment.

Configure the Web.config and App.config files for the Web and Worker Roles, respectively. Then run the WindowsAzureEcho project in the Windows Azure local developer fabric or package and deploy the solution to the Windows Azure service. For more information about running Windows Azure applications locally or in the cloud please refer to the Windows Azure documentation at https://windows.azure.com.

WebRole

The WebRole application sends data over the Service Bus to a listener. You can add your service namespace information to the Web.config file of the WorkerRole applications:


 <appSettings>
    <add key="ServicePath" value="samples/echo"/>
    <add key="ServiceNamespace" value="MY_SERVICE_NAMESPACE"/>
    <add key="IssuerName" value="owner"/>
    <add key="IssuerSecret" value="MY_ISSUER_SECRET"/>
</appSettings>

WorkerRole

The WorkerRole application listens to the Service Bus and writes data to the Windows Azure log. You can add your service namespace information to the WorkerRole App.config file:

<appSettings>
    <add key="ServicePath" value="samples/echo"/>
    <add key="ServiceNamespace" value="MY_SERVICE_NAMESPACE"/>
    <add key="IssuerName" value="owner"/>
    <add key="IssuerSecret" value="MY_ISSUER_SECRET"/>
</appSettings>

 


Did you find this information useful? Please send your suggestions and comments about the documentation.