I recently had written a post of Azure Service bus for accessing on-premise WCF. I had written this post with Azure Appfabric SDK 1.3 and Dot Net Framework version as 3.5.
With the release of Azure App Fabric SDK 1.5, things have changed a lot. If you run sample code mentioned in the above post then it will throw error as - System.Configuration.ConfigurationErrorsException: Invalid element in configuration. The extension name 'transportClientEndpointBehavior' is not registered in the collection at system.serviceModel/extensions/behaviorExtensions.
To avoid this error of service bus release you will need to follow below steps.
First change the dot net framework build version of all projects from 3.5 to 4.0. Remove service bus dll reference from console application which you had specified from GAC assembly. Instead add reference to Microsoft.ServiceBus.dll from location of Appfabric SDK 1.5 installation - C:\Program Files\Windows Azure AppFabric SDK\V1.5\Assemblies\NET4.0
Cause –
This error is displayed when configuration elements in machine.config are missing. Generally a required configuration element gets added automatically when you install Appfabric SDK on your machine. However sometimes it still shows the error.
Resolution –
At path C:\Program Files\Windows Azure AppFabric SDK\V1.5\Assemblies\NET4.0 two exe are present along with service bus dll – “RelayConfigurationInstaller.exe” and “RelayConfigurationInstaller32.exe”.
Open command prompt as an administrator and run following commands –
“C:\Program Files\Windows Azure AppFabric SDK\V1.5\Assemblies\NET4.0\ RelayConfigurationInstaller.exe” /i
“C:\Program Files\Windows Azure AppFabric SDK\V1.5\Assemblies\NET4.0\ RelayConfigurationInstaller32.exe” /i
The above two commands add necessary configuration elements in machine.config.
If you face same scenario when you have web role uploaded to Azure. Then use startup task to run above exe on Azure VM. To run start up task on Azure VM refer following link – Adding DLL in GAC on Azure VM. After above workarounds you should be able to run the service bus code.
Hope this helps.
Cheers…
Happy Programmig!!!
Thank you for your article. That was really helpful :)
ReplyDeletewelcome anonymous!!
ReplyDeletethanks!!! helped me out!
ReplyDelete