WCF concepts: bindings vs. behaviors

 http://www.pluralsight-training.net/community/blogs/aaron/archive/2006/03/02/19470.aspx

 

The Windows Communication Foundation programming model and runtime provide a great framework for thinking about service-oriented systems. I love the way they've abstracted away unnecessary details through a suite of simple concepts that make it easier to think about these types of systems. The most central concepts are services and endpoints.
 
A service exposes one or more endpoints. Each endpoint consists of an address, binding, and contract. The contract is the main thing developers care about when designing the service code. You implement a service contract in a traditional .NET class (by simply implementing the C# interface). The address is simply the location where consumers send SOAP messages in order to integrate with the service. Most developers immediately "get" the address/contract concepts, but bindings often require more discussion.
 
The binding is the thing that influences the transport/message-level details of the endpoint. It's all about "how" once interacts with the endpoint on the wire. The WCF runtime uses the binding configuration to build the appropriate channel stack for processing incoming/outgoing messages. The channel stack sits between the wire and the dispatcher (the thing that actually invokes your service code). Each channel in the stack is responsible for different aspects of messaging processing. There will always be a transport channel, a message encoder (the thing that translates the logical message into bytes), and a number of WS-* protocol channels (for security, reliable messaging, etc). The binding is all about what happens on the wire. In essence, it's what binds messages coming off the wire to the WCF dispatcher.
 
So the dispatcher is the thing that manages the execution of your code. You can influence different aspects of local execution using what WCF calls behaviors. A behavior is just a piece of code that implements a special interface (one which the runtime knows about ahead of time) for "plugging into" the execution process. This is your primary WCF extensibility point. You configure behaviors with a service using .NET attributes or configuration elements. WCF ships a suite of built-in behaviors that address the most desired behavioral customizations. Behaviors are all about local execution -- what happens within the local CLR host.
 
Bindings and behaviors are the two primary things you'll configure in WCF systems: bindings to configure wire-level agreement and behaviors to customize local execution.

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值