Introduction to the new Student entry program in WCF

Source: Internet
Author: User

Freshman enrollment system for so long, the new partner asked me about the WCF things, I said is foggy, or back to summarize, otherwise never know how much they know.

I. Overview

1. WCF--Services

WCF (Windows communication Foundation) is a set of data communication application development interfaces developed by Microsoft, which can be translated into a Windows communication interface, which is. NET Framework is part of the. Introduced by the. NET Framework 3.0.

The ultimate goal of WCF is to send and receive messages between customers and services through a process or a different system, through a local network, or over the Internet.

WCF incorporates the capabilities of Web services,. NET Remoting, Message Queuing, and enterprise services and integrates them in Visual Studio.

WCF is dedicated to service-oriented development.

2, contracts--contract

In WCF, contracts are divided into four types:

(1) Services contract: Service contract terminology defines service operations

<span style= "FONT-SIZE:18PX;" >    [servicecontract]//is used to instruct WCF that this class or struct can be remotely called Public    interface ifreshmajorservicewcf    {        #region Query Professional (query with college parameters) + querymajor ()        [OperationContract]///To indicate that WCF can be called remotely by this method.        list<freshmajorservicecontracts> querymajor (String department);        #endregion    }</span>
(2) Data contract: Contractused to define data structures

    [datacontract]//is used to instruct WCF that this class or struct can be serialized and transmitted to the public    class freshmajorservicecontracts    {        [datamember]// Used to indicate that the property or field of WCF can be serialized for transmission. Public        string ID {get; set;}                  Professional ID        [DataMember] public            string name {get; set;}                Professional name    }

(3) Exception contract: Fault contract the handling of custom error exceptions

in the By default, when the server throws an exception, the client can receive a description of the exception information, but these descriptions tend to be uniform in format and sometimes difficult to obtain useful information, at which point we can customize the format of the exception message and put the message we care about in the error message to the client. At this point, you need to add a class that customizes an error message on the method, and then add faultcontract to the function that will handle the exception, and return the exception information as a custom format.


(4) Message contract: Message contract for controlling the format of messages

You can customize the message format, including the message header, the body of the message, and whether to encrypt and sign the contents of the message.

II. Application of the project

Unified Service Interface

Prior to our development is the need to publish multiple interfaces, the client to access each interface; With WCF we let this interface inherit all of these interfaces, and eventually we only publish an interface to access all of our services. This is the unified service interface. We want to publish our WCF service to IIS.


Outward-Published interfaces:

    [ServiceContract]    

                    

Third, WCF benefits

1. Unity

We can create services like objects, and WCF is a consolidation of some technologies, such as the Asmx,.net remoting,enterprise service. Although the real benefits are not realized now, they are really powerful.

2. Interoperability

The most basic communication mechanism of WCF is the Simple Object Access Protocol, which guarantees the interoperability of the system. You can communicate across processes, across machines, and even across platforms, as long as the standard Web Servie is supported.

3. Reliability of security Domain

ws-security, Ws-trust and the ws-secureconversation are added to the SOAP message for user authentication, data integrity authentication, data privacy and many other security factors.

4. Compatibility

WCF takes full account of compatibility with legacy systems. Installing WCF does not affect legacy technologies such as ASMX and. Net Remoting. Even for WCF and ASMX, although both use SOAP, WCF-developed-based applications can still interact directly with ASMX.


This article is just basic to learn some of the relevant knowledge of WCF, followed by a step-by-step understanding of WCF's application in the project.

Introduction to the new Student entry program in WCF

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.