Export (0) Print
Expand All

Building a Service for Service Bus

Updated: June 18, 2014

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
  1. 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.

  2. Implement the WCF contract for your service. The implementation of the contract is used later, as part of the hosting process.

  3. Configure your service, as defined in Configuring a WCF Service to Register with the 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.

  4. 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 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 the Service Bus.

Hosting Behind a Firewall with Service Bus
This topic describes some of the important items to remember when hosting behind a firewall.

See Also

Show:
© 2014 Microsoft