Building a Service for Service Bus
Updated: August 26, 2015
Using Microsoft Azure Service Bus requires creating and then hosting a Web service that registers itself with Service Bus.
Hosting an application means instantiating and running a service that is configured to use a relay binding that connects to Service Bus. Therefore, the hosted service is the originating service, which the application registers with Service Bus. Clients then use the service endpoint exposed by Service Bus, which relays authorized messages to and from the originating service regardless of where it is physically located.
Note that, before you actually write the code that instantiates and runs a service, you must perform several steps. The following procedure describes the setup work necessary before hosting a Service Bus service.To set up a service for hosting
Design the WCF contract for your service, as described in Designing a WCF Contract for Service Bus. The contract, as a WCF interface, is the same for both service and client applications.
Implement the WCF contract for your service. The implementation of the contract is used later, as part of the hosting process.
Configure your service, as defined in Configuring a WCF Service to Register with Service Bus. Configuration can be performed programmatically or through the App.config file. Common scenarios include defining the service endpoint and security in the App.config file. These values are later used implicitly or explicitly, when the endpoints are created.
Create the authorization and authentication credentials, as defined in Securing and Authenticating a Service Bus Connection. As in the previous step, the credentials can be defined either programmatically or in the App.config file.
After completing these steps, you can host your service.
In This Section
The following topics describe the most common hosting scenarios and contain information to help with common issues related to hosting.
- How to: Host a Service on Azure that Accesses Service Bus
- This topic describes how to host a Service Bus service on Azure.
- How to: Host a WCF Service that Uses the Service Bus Service
- This topic describes how to create a WCF service host using the Microsoft Azure SDK.
- How to: Create a REST-based Service that Accesses Service Bus
- This topic describes how to use the WCF Web Programming Model to create and host a WCF REST-style Web service that registers a REST service endpoint with Service Bus.
- Hosting Behind a Firewall with Service Bus
- This topic describes some of the important items to remember when hosting behind a firewall.