static void QueuedMessageWcfServiceHandler() { // Create a ServiceBus queue. QueueDescription queue = CreateQueue(); // Create a factory and client to talk to this queue MessagingFactory factory = MessagingFactory.Create(ServiceUri, TokenProvider); QueueClient client = factory.CreateQueueClient(queue.Path); // Use the extension method to start the WCF service // which will handle the queued messages based on its Action property client.StartListener(typeof(MyActionOrientedEchoService)); string requestMessage = "Hello World!"; // Send message to the queue - to the EchoOnce operation BrokeredMessage message = new BrokeredMessage(requestMessage); message.SetAction("EchoOnce"); Console.WriteLine("Message '{0}' sent with '{1}' action", requestMessage, "EchoOnce"); client.Send(message); // Send message to the queue - to the EchoTwice operation BrokeredMessage anotherMessage = new BrokeredMessage(requestMessage); anotherMessage.SetAction("EchoTwice"); Console.WriteLine("Message '{0}' sent with '{1}' action", requestMessage, "EchoTwice"); client.Send(anotherMessage); // Cleanup client.StopListener(); client.Close(); factory.Close(); }