Windows Communication Foundation (Part One)

Source: Internet
Author: User
Tags msmq

Preface:WCF was launched by Microsoft Based on Service Oriented Architecture. net platform framework products, which represent a development direction of software architecture design and development, also plays a very important role in Microsoft's strategic plan. Understanding and understanding of WCF is very necessary for programmers, especially those developed based on Microsoft products. For WCF, I have also begun to look at the door and give such an introduction with a learning attitude. The content in this article mainly refers to Microsoft official documents and materials, as well as a large number of technical materials about WCF. These materials are mainly in English and are not easy for domestic programmers to learn about WCF. Although I am a beginner, I am willing to give such an introduction. As I am a beginner, and I am not very familiar with English skills, it is inevitable that there will be omissions in this article. At the same time, I also hope to express my experiences and opinions as much as possible in this article, which increases the possibility of errors. In addition, since there is no formal version of WCF, the related technical descriptions and codes in this article will change according to different versions, so I can only give some instructions as far as possible. This article will be a series of articles that are pieced together. It is a series, but there is no strict progressive relationship, but I hope to have a relatively comprehensive introduction to WCF as a whole. In addition, I also hope that this article will help me learn more easily.

1. What is WCF?
According to Microsoft's official explanation, WCF (formerly called "Indigo") is a unified framework for building and running Service-Oriented applications using managed code. It enables developers to build a secure, trusted, and transactional solution across platforms, and to be compatible with existing systems. WCF is a set of developers for Microsoft Distributed Application Development. It integrates all technologies related to distributed systems on the. Net platform, such as. Net Remoting, ASMX, WSE, and MSMQ. In terms of the scope of communication (Communiation), it can be cross-process, cross-machine, cross-subnet, enterprise network, or Internet; in terms of host programs, it can be ASP. NET, EXE, WPF, Windows Forms, NT Service, COM + as the Host (Host ). The protocols supported by WCF include TCP, HTTP, cross-process, and custom. Security modes include SAML, Kerberos, X509, user/password, and custom. That is to say, it is easy to develop a SOA-based Distributed System under the WCF framework. Microsoft includes all the technical elements related to this, and has mastered the concept, it is equivalent to mastering the key to open the SOA door.
WCF is built on. Net Framework 2.0. The official version should be Release as the core part of Windows Vista. However, this does not mean that WCF can only run under Windows Vista. If WinFX Runtime Components is installed, it can still be used in Windows XP and Windows 2003 operating systems. Visual Studio 2005 does not contain WCF. However, after WinFX Runtime Components is installed, you can develop and create a WCF program in Visual Studio 2005.
Currently the latest WCF version is February 2006 CTP, download page is: http://www.microsoft.com/downloads/details.aspx? FamilyId = F51C4D96-9AEA-474F-86D3-172BFA3B828B & displaylang = en. Use wcf.exe to use a few related tools, such as svcutil.exe, so you also need to download the WinFX Runtime Components SDK, its download page is: http://www.microsoft.com/downloads/details.aspx? FamilyId = 9BE1FC7F-0542-47F1-88DD-61E3EF88C402 & displaylang = en. You can select Network or local installation to install the SDK. For local installation, the file size is about 1 GB, which is an ISO file. After the SDK is installed, there is a microsoft SDK directory under the program files directory.
WCF is Microsoft's key product, so it also launched a special official website (http://windowscommunication.net), the site has the latest WCF news release, as well as introduction to the WCF technical documentation and sample code.

Ii. Benefits of WCF
In the article Introducing Windows Communication Foundation prepared by David Chappell, a fresh example is provided to illustrate the advantages of WCF. Suppose we want to develop a new application for a car rental company for Car Rental booking service. The taxi booking service will be accessed by a variety of applications, including Call Center, J2EE-based taxi booking service and Partner Application ),:
 


The call center runs on Windows and is an application developed under. Net Framework. The user is an employee of the company. Because the car rental company has merged another leasing company, the original car booking service application of the company is a J2EE application, running in a non-Windows operating system. The call center and existing car Booking applications run in the Intranet environment. The partner's applications may run on various platforms. These partners include travel agencies, airlines, etc. They will access the car booking service over the Internet to lease cars.
Such a case is a typical distributed application system. Without WCF, how should I develop the existing. Net technology?
First, consider the call center. Like the car booking service we want to develop, it is a. Net Framework-based application. The call center has high requirements on system performance. Under such conditions,. Net Remoting is the best implementation technology. It provides high-performance communication between. Net and. Net.
To achieve communication with existing J2EE car Booking applications, only the SOAP-based Web Service can achieve this purpose, which ensures cross-platform communication; the partner uses ASP. net Web Service (ASMX) is also a reasonable choice, which ensures cross-network communication. Because communication between networks is involved, we also need to fully consider the security of communication. Using WSE (Web Service Enhancements) can provide security assurance for ASMX.
A good system not only ensures the security and high performance of access and management, but also ensures the trustworthiness of the system. Therefore, transaction processing is a factor that must be taken into account for enterprise applications. This is also true for car booking services. In. Net, Enterprise Service (COM +) supports Transactions, including Distributed Transactions (Distributed Transactions ). But for Enterprise Service, it only supports a limited number of communication protocols.
If asynchronous calling, offline connection, and breakpoint connection are also considered, we also need to apply MSMQ (Microsoft Message Queuing) and use Message queue to support Message transmission between applications.
In this case, we need to establish a good taxi booking service system. net distributed technology, including. net Remoting, Web Service, COM + and other five technologies, which are not conducive to developers' development, but also increase program maintenance difficulty and development costs. It is precisely because of this defect that WCF will be in. net 2.0 was launched by Microsoft as a brand new distributed development technology. It integrates the distributed technology and has become an ideal solution for distributed development. Demonstrate the comparison between WCF and previous technologies:
 

From a functional perspective, WCF can be regarded as a union of ASMX,. Net Remoting, Enterprise Service, WSE, MSMQ, and other technologies. (Note: This statement only applies to functions. In fact, WCF is far from simple union. It is a service-oriented product and has changed the normal development mode .) Therefore, for the above example of the Auto Booking Service System, the use of WCF can meet the needs of security, trustworthiness, interoperability, cross-platform communication, and so on. Developers no longer need to learn about. Net Remoting, ASMX, and other technologies separately.
In summary, WCF has the following advantages:
1. Uniformity
As described above, WCF is an integration of ASMX,. Net Remoting, Enterprise Service, WSE, MSMQ, and other technologies. Since WCF is fully written by the managed code, developing the WCF application and developing other. there is no big difference between. Net applications. We can still use WCF to create service-oriented applications like creating object-oriented applications.
2. Interoperability
Since the most basic communication mechanism of WCF is SOAP, this ensures the interoperability between systems, even when different contexts are run. This communication can be Based on. Net to. Net, as shown in:
 

Cross-process, cross-machine, or cross-platform communication is supported as long as standard Web services, such as J2EE application servers (such as WebSphere and WebLogic) are supported ). Applications can run in Windows or other operating systems, such as Sun Solaris, HP Unix, and Linux. As shown in:
 

3. Security and trustworthiness
WS-Security, WS-Trust, and WS-SecureConversation are added to SOAP messages for user authentication, data integrity verification, data privacy, and other Security factors.
WS-ReliableMessaging is added to the SOAP header to allow trusted end-to-end communication. The SOAP-based information exchange based on WS-Coordination and WS-AtomicTransaction supports two-phase commit transactions ).
The preceding WS-policies are supported in WCF. For Messaging, SOAP is the basic protocol of Web Service. It contains the header and body ). In the Message header, WS-Addressing is defined to locate the address information of the SOAP Message, and MTOM (Message Transmission Optimization Mechanism, Message Transmission Optimization Mechanism) is also included ). :
 

4. Compatibility
WCF fully considers compatibility with old systems. Installing WCF does not affect existing technologies such as ASMX and. Net Remoting. Even though both of them use SOAP, applications developed based on WCF can still directly interact with ASMX.

<To be continued>

Note: This part mainly comes from David Chappell, Introducing Windows Communication Foundation

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.