Building a Service for the Service Bus
Unless you are building a non-Windows Communication Foundation (WCF) REST application that creates a message buffer, using the Windows Azure Service Bus requires creating and then hosting a Web service that registers itself with the Service Bus. (For more information about using a message buffer, see AppFabric Service Bus Message Buffer Overview.)
Hosting an application means instantiating and running a service that is configured to use a relay binding that connects to the Service Bus. Therefore,, the hosted service is the originating service, which the application registers with the Service Bus. Clients then use the service endpoint exposed by the 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 an 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 the 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 the Service Bus. Configuration can be done programmatically or through the App.config file. Common scenarios include defining the service endpoint and security in the App.config file. These values are used implicitly or explicitly later 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 WCF Service that Uses the Service Bus Service
- This topic describes how to create a WCF service host using the Windows Azure SDK.
- How to: Host a Service on Windows Azure that Accesses the Service Bus
- This topic describes how to create a WCF service host using the Windows Azure SDK, that you can run in Windows Azure.
- How to: Create a REST-based Service that Accesses the 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 the Service Bus.
- How to: Use a Third Party Hosting Service with the Service Bus
- This topic describes how to create and host with a third-party hosting system a WCF Web service that registers a service endpoint with the Service Bus.
- Hosting Behind a Firewall with the Service Bus
- This topic describes some of the important items to remember when hosting behind a firewall.