Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
Introducing Windows Azure- P33:The cloud platform is getting more and more attractive to the computing world. Today, service-oriented architecture (SOA) and aspect-oriented programming (AOP) techniques are widely used in enterprise solutions. A question an IT management team or a software development team may ask is, what is the next trend going to be? Cloud computing seems to be the right answer. | CHAPTER 5 AZURE .NET SERVICES ACCESS CONTROL Console.WriteLine results Trace.WriteLine results return message region Console Utilities static public string ProcessPassword StringBuilder password new StringBuilder ConsoleKeyInfo info Console.ReadKey true while info.Key ConsoleKey.Enter if info.Key ConsoleKey.Backspace if password.Length 0 password.Remove password.Length - 1 1 Console.Write b b else if info.KeyChar password.Append info.KeyChar Console.Write info Console.ReadKey true Console.WriteLine Console.Write string.Format Please sit back and wait for your account to be authenticated from .Net access service 0 0 . 0 Environment.NewLine return password.ToString endregion 2. Define a client communication channel interface lAccountFederationClientChannel derived from the interface System.ServiceModel.IClientChannel in order to do the duplex communication. The code is shown in Listing 5-2. This listing is for the implementation of the Main function of the host application. 133 CHAPTER 5 AZURE .NET SERVICES ACCESS CONTROL Listing 5-2. WCF Client Channel Service Contract Definition using System using System.Collections.Generic using System.Linq using System.Text using System.ServiceModel namespace AzureForDotNetDeveloper.DotNetService.ServiceBus.WCFServiceLibrary public interface IAccountFederationClientChannel lAccountFederationService IClientChannel 3. Next we are going to build a console application to host the WCF service. As Listing 5-3 shows we need to do the following steps to the initialization on the server side. 1. Create a endpoint URI. The URI address for the .NET Access Control Service is sb servicebus.windows.net services AzureForDotNetDeveloper SolutionName . 2. Define a TransportClientEndpointBehavior instance. This instance takes the user credential information. Currently the .NET Access Control Service accepts three types of credential Solution Password Windows CardSpace Information Card and X.509 Certificates. In this example we use the user name .