立即注册 登录
汉山 返回首页

翰山的个人空间 http://www.hanshan.info/?2 [收藏] [复制] [分享] [RSS]

日志

WCF (1), Basics

已有 7670 次阅读2021-4-11 17:22 |个人分类:Tech|系统分类:原创博文 | 宽屏 请点击显示宽屏,再点击恢复窄屏 | 动漫全图 如只见部分动漫,请点击显示全图,再点击恢复窄图

In this series of articles, we will discuss the major features of WCF:

 

Introduction

 
We will discuss WCF major features in the following order:
  •  What: WCF
    • WCF Service
    • WCF Host
    • WCF Client
  •  Why: WCF
    • WCF = Webservice + .Net remoting + MSMQ + COM+
  •  Fundamentals of WCF
    • EndPoint of WCF: A + B + C
      •  Address
      • Binding
      • Contract
  •  Hosting
    • Self Hosting
    • IIS
    • WAS hosting (Windows Process Activation Service)

What WCF is

 
Windows Communication Foundation (WCF) is a framework for building service-oriented applications to send data as asynchronous messages from one service endpoint to another, where
  • Service endpoint --- hosted by IIS, or in an application.
  • Client endpoint --- to requests data from a service endpoint.
  • Messages --- can be as simple as a single character or word sent as XML, or as complex as a stream of binary data.
WCF is basically used to create a distributed and interoperable Application. WCF Applications came into the picture in .Net 3.0 Framework. It includes three parts:
  • WCF Service : What is the service and what it is providing.
  • WCF Service Host: Where is the Service hosted.
  • WCF Service Client: Who is the client of the Service.
 

Why WCF


Why we need WCF Applications

Suppose, you have two clients- one wants to use a Web Service, which sends data over the network, using Http protocol and want reply in XML format, so we will create a Web Service.

The other wants to send the data, using Web Service over the network, using TCP protocol and replying in binary format, then we need to implement a remote Web service with TCP protocol (the following graph shows the situation).
Graph Borrowed from


Problem

For this situation, we need to create two different Services for two different clients, while using WCF will solve this problem with one single service consumed by two different clients- either they want same protocol or a different protocol. We specify the protocol name in an endpoint attribute of the Web Service (the following graph shows the WCF solution). 
Graph Borrowed from
 
Solution: WCF

WCF unites all the technologies under one umbrella:

 
WCF = Webservice + .Net remoting + MSMQ + COM+
 


Fundamentals of WCF

 

EndPoints:

 
Endpoints: Addresses, Bindings, and Contracts

All communication with a WCF service occurs through the endpoints of the service. Endpoints provide clients access to the functionality offered by a WCF service that includes three parts (Endpoints = A + B+ C):

  • Addresses (Where?)
  • Bindings    (how?)
  • Contracts   (What?)

Address:

the address of WCF Service, where the Service is hosted? It gives the exact URL of Web Service, where the Service hosts the pattern of URL, which is-

Scheme://domain/[:port]/path
net.tcp://localhost:1234/MyService
http://localhost:1234/MyService
 
The preceding is the format of an address. Whereas the first part is thetransport schema, thesecond part is the server location.
 
 

Bindiing:

 
It describes the way or mechanism by which the user will communicate with WCF Service. It constitutes some binding element, which creates the structure of communication such as some transport protocols like HTTP, TCP etc. Message format or security techniques etc.
 
 
 
Following the decision diagram to choose a binding:
 
 
Note:
 
We will discuss more details for Bindings, and Channel in the article: WCF (3), Bindings and Channel Stack.
 
 

Contract:

 
Contract is what functionality and operation is being provided by  the service (we will discuss more details in the article WCF (2), Contracts in Various Types).
 

Hosting:

 
WCF supports following types of hosting-
  • IIS Hosting
  • Self hosting 
  • WAS hosting (Windows Process Activation Service)
Following the decision diagram to choose a hosting:
 
 

Summary

 
In this article, we discussed WCF the basic and fundamental features, such as What WCF is, Why WCF,  major features. We will discuss more details for Bindings and Channel Stack, and Contracts in following articles WCF (3), Bindings and Channel Stack and WCF (2), Contracts in Various Types, respectively.
 
 

鲜花

真棒

玩闹

同情

看看

困惑

震惊

bad

评论 (0 个评论)

facelist doodle 涂鸦板

您需要登录后才可以评论 登录 | 立即注册

Archiver|手机版|小黑屋|汉山网    

GMT-5, 2024-3-19 06:21 , Processed in 0.055773 second(s), 20 queries .

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

返回顶部