Deploying WCF Service in Worker Role with connection on service Bus (part 1) : Configuration File

Last week, I’ve published a Worker Role on Azure. This Worker role contains a WCF Service that connect to the service Bus.

First I’ve tested my role on my local emulator and the connection with Azure SB was correct. I was able to call my WCF Service with SoapUI using the endpoint

When I’ve deployed in Azure, I’ve issue some problem, first, don’t forget to configure your azure reference with the following property :

Copy locale = True

Then to use the service bus, you need a reference to :

Microsoft.ServiceBus.dll (I you don’t have this dll, you have to install the windows Azure AppFabric SDK – currently the last version was 1.5)

And finally, don’t forget to enable intelliTrace to debug your application before publish to Windows Azure. In my intelliTrace, I had the following two errors :

Invalid element in configuration. The extension name ‘transportClientEndpointBehavior’ is not registered in the collection at system.serviceModel/extensions/behaviorExtensions.

Configuration binding extension ‘system.serviceModel/bindings/ws2007HttpRelayBinding’ could not be found. Verify that this binding extension is properly registered in system.serviceModel/extensions/bindingExtensions and that is spelled correctly.

These two errors was du to a missing configuration of the machine.config that host your application. Indeed, that why we must set the copy local = true, because the instance of Windows Server (2008 or R2) is not fully configured. But we can configure the web.config or app.config of our application. For this, we can add :

<add name=”transportClientEndpointBehavior” type=”Microsoft.ServiceBus.Configuration.TransportClientEndpointBehaviorElement, Microsoft.ServiceBus, Version=X.X.X.X, Culture=neutral, PublicKeyToken=31bf3856ad364e35″/> </behaviorExtensions> <bindingExtensions> <add name=”ws2007HttpRelayBinding” type=”Microsoft.ServiceBus.Configuration.WS2007HttpRelayBindingCollectionElement, Microsoft.ServiceBus, Version=X.X.X.X, Culture=neutral, PublicKeyToken=31bf3856ad364e35″/> </bindingExtensions>

Where X.X.X.X is the version of your Microsoft Service Bus assembly.

If you use some other binginds, like netTCPRelay or Basic … and you don’t know exactly the type, you can see in your machine.config after installing the SDK and execute the RelayConfigurationInstaller.exe

We will see in future post more details on implementing service bus.

This entry was posted in Azure, WCF and tagged , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s