WCF service calls differ from normal HTTP requests

Source: Internet
Author: User

WCF technology has been used for some time, only to know the reference service address after the call inside the method on the line. Before thinking about some of the things in WCF, it is now confusing to some of WCF, for example, why there are proxy classes, why there are bindings, and what the channel is for.

Today, with the traditional browser request to tell my personal opinion, as for the basic technical point of WCF, what channel, channelfactory,clientbase and so on I don't care.

Because of the limited technology, the wrong place welcomes criticism.

So let's explain some of the technical terms in WCF with the example of a traditional browser (WCF service is hosted in IIS)

Channel

When I enter the address in the browser, I press ENTER to get the content we want to see.

In fact, when we press the return of the moment, the browser to help us do a lot of work,

such as: to establish a connection with the server, the content sent to encode, data transmission, etc., these steps correspond to the channel in the WCF, the role of the channel is the channel of communication,

Channel is not only one, the most important is the encoded channel, transmission channel, it is these channels to resolve two endpoint data transmission/reception and problems.

In a normal browser request, the channel is created by the browser, and in WCF, the information is created by the System.ServiceModel component. So we have to refer to this component when we use WCF

Address

The address of WCF is the same as the address of the browser, and we only know where the service we are requesting is.

Binding

If we listen to the HTTP request using the listening software, such as Fiddler can easily find the request when there is such information:

This information in the HTTP request is called the request header or the response header, it solves the client and the server with what coding rules, what data type, data size and other provisions.

A similar rule in WCF is called "binding",

such as: In the anti-compiler to assign a value to the binding object Closetimeout,sendtimeout is very familiar with, webconfig in the binding configuration there is a set of related content. Of course, WCF's bindings are more powerful than browser functionality.

proxy class

First of all, the serialization, the client and the service to pass the object must be able to serialize, because after the serialization of the object can be transmitted in the network, we know that the final form of network transmission is the bitstream, and serialization is the data object into a bit stream.

When we refer to the service address (and possibly generate a proxy class using the Build tool), we can see that the code in Reference.cs is very similar to what is seen in the class that serves the service. This file is actually present in our local folder, and that file is our vs, or the build tool provides the metadata information based on the service in our local generated class.

The function of this class is to serve our local code,

First, the Entity Data class, I can new out of the entity object and the server for data transfer, such as parameter objects.

Then is the Operation class, is the class with the client later, when we call the method in this class, the channel is created, the channel can be called to the service side of the method, also completed the remote call, the server returned to our results.

Since the WCF call (the IIS hosting environment) is the same thing as the browser request, why can't I enter the service address in the browser to get the results processed?

Because WCF uses the SOAP protocol, the SOAP protocol is also based on the HTTP protocol, but the browser cannot handle SOAP data at all.

Contract

Declares which functions and classes can let clients use the

So the main function of WCF can be regarded as two points: encapsulates a whole set of network communication functions, in essence, or tcp/ip,socket,http that one thing. Second, data serialization and deserialization, with soap can be in the network or remote terminal to transfer objects.

WCF service calls differ from normal HTTP requests

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.