Advantages and features of C # WCF

Source: Internet
Author: User

Windows Communication Foundation (WCF) is a series of Microsoft-developedapplication framework for data communication support, can be translated into Windows Communications development platform. Integrates the original. NET Remoting for Windows communications,WebService,the mechanism of the socket, and fused with HTTP and FTP of the relevant technology. The simple boils down to four parts 1> Network Service protocol, which is to open the client access with what network protocol. 2&GT: An agreement for a business service that declares what business the service provides. 3> The data type declaration, which is the data portion of the client-to-server communication is consistent. 4> transport security-related definitions. Both sides of the communicationCommunication MethodsByContractTo set. The communication between the two parties followedCommunication MethodsByProtocolBinding to set. During the communicationSecurity, by both sidesConventionLevel of security to be set. The basic concept of WCF is a contract (contract) to define the agreement betweenmust be embodied in an interface, and the actual service code must be derived from these contract interfaces and implemented。 The contract is divided into four types: Data contract, which specify the data format when communicating with each other. Service contract, define the definition of the service. Operation Contract (Operation contract), to set the method of service delivery. Message contract, which provides a specification for overwriting message content during communication. The WCF implementation already supports theTransport Level Security(Transport-level security) andMessage Hierarchy Security(message-level security) two kinds. Transport Level security: Encryption during data transfer, such as SSL. Message hierarchy Security: Encrypt when data is processed, such as using digital signatures, hashing, or using key cryptography. Advantages: 1, unity it is integrated by a variety of technologies, but can still be written in object-oriented code like. NET because it is written in managed code. 2, interoperability it uses the SOAP communication mechanism, guarantees the interoperability between the system, can cross the process, the cross-mechanism. Even cross-platform communications as long as he supports Web Service. 3, security and reliability because it contains multiple protocols, there are several security mechanisms for protocols, especially soap. 4, compatibility It can be used on the new and old platform. Example of a simple WCF instance. 1,iservice1 defines a method that must have a contract flag. [OperationContract]
String Helloword (); Service code on 2,SERVICE1.SVC must be derived from these contract interfaces and implement public string Helloword ()
{
Return "Hello wcf!";
}3, run service1.svc If you have a WCF test client installed, the following interface will appear Helloword () is a method that you created, double-click it. Clicking on the call will result in the relevant results. 4, you can also create a Windows Forms program yourself to invoke this service. After adding a service reference to this form program, the service will be displayed with the implementation code: Servicereference1.service1client C = new WindowsFormsApplication1.ServiceReference1.Service1Client ();
string s = C.helloword ();
MessageBox.Show (s); a popup box appears after running.

Advantages and features of C # WCF

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.