[英]What is the difference between ServiceBehavior and CallbackBehavior in WCF?
What is the difference between ServiceBehavior and CallbackBehavior in WCF? WCF中的ServiceBehavior和CallbackBehavior有什么区别?
and also between contract and a behavior. 以及契约与行为之间
The ServiceBehaviour as name implies controls how the service behaves. 顾名思义,ServiceBehaviour控制着服务的行为。 Taken from MSDN:
来自MSDN:
Behaviors are types that modify or extend Service or Client functionality.
行为是修改或扩展服务或客户端功能的类型。 For example, the metadata behavior that ServiceMetadataBehavior implemented controls whether the Service publishes metadata.
例如,ServiceMetadataBehavior实现的元数据行为控制服务是否发布元数据。 Similarly, the security behavior controls impersonation and authorization, while the transactions behavior controls enlisting in and auto-completing transactions.
类似地,安全行为控制模拟和授权,而事务行为控制登记和自动完成事务。
A CallbackBehaviour is an EndpointBehaviour that is used for duplex communication. CallbackBehaviour是用于双工通信的EndpointBehaviour。 There is also another behaviour type which is an OperationBehaviour
还有另一种行为类型是OperationBehaviour
A contract is the public interface between the client and the service. 合同是客户端和服务之间的公共接口。
You can dig into this a bit on MSDN they have a great section on WCF Fundamentals . 您可以在MSDN上对此进行深入研究,他们对WCF基础知识有很大的介绍。
A Service Behavior is a type that implements IServiceBehavior and applies to Services.
服务行为是一种实现IServiceBehavior并应用于服务的类型。
Basicly it defines how your Service will behave in general, what kind of message and security it will use. 基本上,它定义了服务的一般行为,将使用哪种消息和安全性。
It's similar for Callback Behavior, it defines how the callback on an Operation will behave, see here for WCF Callbacks; 与回调行为类似,它定义了操作上的回调的行为方式,有关WCF回调 ,请参见此处。 a beginners guide .
初学者指南 。
A contract defines what operations you have and how you use them is defined by the behaviour. 合同定义了您拥有的操作以及如何使用它们由行为定义。 Here is an example of a service contract .
这是服务合同的示例。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.