WCF application instance

Source: Internet
Author: User
Tags msmq

This article from: http://www.cnblogs.com/HeroBeast/archive/2009/04/14/1435488.html

 

 

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. Understand and master the concept Program Developers, especially programmers based on Microsoft products, are very necessary.

1. What is WCF?

According to Microsoft's official explanation, WCF (formerly known as "Indigo") is hostedCodeEstablishes and runs a unified framework for service-oriented applications. 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.

 

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.

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.

Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

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.