Sort out the ideas and explore WCF (1)

Source: Internet
Author: User

(Preface)

We are used to using the WCF Project template in vs2008, So server creation is basically useless.

Because we use the Mex binding by default, we can easily add server reference by right-clicking the project in vs2008 on the client side.

Vs2008 sets us to focus on the business logic of foucus, while blurring the nature of WCF.

So I often get confused, and even the most basic concepts of WCF are sometimes confused.

After clearing up your ideas, you may have the following questions.

 

(1) Silly WCF

First, a simple WCF demo is provided. The server uses the project template to automatically generate the demo. The client directly adds a reference to this service.CodeDownload:

First look at the project wcfservice3, which is our service. Note that this is a WCF Service application ,:

It has several features:

1) the service is hosted in IIS. When you press F5, you will find an icon in the lower right corner of the desktop, right, on the left side of the MSN icon, this is file-based IIS. Of course, you can also throw this service to the IIS console.

2) There is an SVC. You can use it as an asmx file in WebService.

3) The following binding exists in Web. config:

<Endpoint address = "" binding = "wshttpbinding" Contract = "wcfservice3.iservice1">

<Endpoint address = "mex" binding = "mexhttpbinding" Contract = "imetadataexchange"/>

The first endpoint is for business purposes, and the second is for Mex binding to Exchange metadata.

 

Let's look at consoleapplication1 again. This is a client.

Because the server is bound with MEX, in the client, right-click leleapplication1, select add service reference, and enter the address of the above service, such as http: // localhost: 51166/service1.svc, you can add a reference to this service, as shown in:

Everything works well. However, I would like to say that the ease of operation of vs2008 makes it too easy for us to think about 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.