Basic Service Bus Programming Lifecycle
The Windows Azure Service Bus enables Web service applications expose their functionality to clients through firewalls and on different application platforms. This topic outlines the tasks that are required to build an application that uses the Service Bus to expose its functionality to clients. For a working sample application, see the Service Bus Relayed Messaging Tutorial.
Basic Service Bus Tasks
The tasks required to create a Windows Communication Foundation (WCF) application that accesses the Service Bus are as follows. If you are hosting in Windows Azure, see Windows Azure and Service Bus Programming Lifecycle. If you want to use a REST-style application together with the Service Bus, see REST and Service Bus Relay Programming Lifecycle.
- Create a service namespace. This service namespace creates a named scope within which the Service Bus creates resources to support Web services regardless of where they are originally hosted or how. For more information, see Managing Service Bus Service Namespaces.
- Define the service contract, whether using WCF or using HTTP programming directly in the .NET Framework (if you are using a message buffer). A contract specifies the signature of the service, the data it exchanges, and other required inputs, behavior specifications, and object invariants. For more information, see Designing a WCF Contract for the Service Bus.
- Implement the contract. To implement a service contract, create a class that implements the interface and specify custom runtime behavior.
- Configure the service by specifying endpoint and other behavior information. For more information, see Configuring a WCF Service to Register with the Service Bus.
- Build and run the service. For more information, see Building a Service for the Service Bus.
- Build and run the client application. For more information, see Building a Service Bus Client Application.
As with any iterative, service-oriented software development, it may not always be appropriate to follow the previous steps sequentially, or even start from step 1. For example, if you want to build a client for a pre-existing service, you start at step 5. Or, if you are building a host service that others will use, you can skip step 6.