Configuring a WCF Service to Register with the Service Bus
Updated: June 18, 2014
Configuring an application that uses Microsoft Azure Service Bus requires that you set the following properties:
The name of the service you are exposing.
The interface (representing the service contract) your application either exposes or connects through.
The type of binding your application uses, which includes transport, security, and encoding settings.
The address at which the contract is available.
When using WCF you can set these properties in an WCF service or client application either programmatically or in an App.config file. However, it is usually best to specify the binding and address information declaratively in a configuration file, instead of imperatively in code unless your specific scenario requires it. Defining endpoints in code is usually not practical because the bindings and addresses for a deployed service are typically different from those used as the service is being developed. More generally, keeping the binding and addressing information out of the code enables them to change without having to recompile or redeploy the application.
The following list contains the general scenarios for configuring a Service Bus application. For additional information about how to configure a WCF application, see Configuring Services in the WCF documentation.
This type of application is a WCF SOAP-based application that is configured to use Service Bus as a secured relay to connect to other applications. The only differences required to use Service Bus are the type of binding and the endpoint address. WCF applications that use Service Bus use one of the relay bindings available in the SDK; bindings that have authentication and transport elements not present in the standard WCF bindings. Similarly, the endpoint address that is used for the service endpoint is a Service Bus URI based on the registered Service Bus namespace name (and may also have a different protocol scheme), whereas a regular WCF application uses an address based on the local host. Because these are the only two configuration differences, you can often – but not always – just reconfigure a currently existing WCF application to expose its services through the Service Bus
The topics in this documentation describe are two types of REST applications: those that use the WCF Web programming model and the Azure SDK, and one that does not. However, the topics in this section only describe REST applications that use the Azure SDK as a programming foundation.
If your application does use the Azure SDK, you can configure your application in the same way as any other REST-based WCF service: you must use a relay binding that supports HTTP, such as WebHttpRelayBinding or WS2007HttpRelayBinding, and you must apply the appropriate WCF attributes to your interface, and confirm that your implementation can send and receive HTTP messages and events. For more information, see Designing a WCF Contract for Service Bus.
In This Section