简体   繁体   English

WCF中的ServiceBehavior和CallbackBehavior有什么区别?

[英]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.

相关问题 WCF中的WSDL和Mex端点之间有什么区别 - What was the difference between WSDL & Mex Endpoint in WCF DDD服务和WCF服务之间有什么区别? - What is the difference between a DDD service and a WCF service? 在 channelfactory WCF Net.Pipe 上设置 ServiceBehavior - Set ServiceBehavior on channelfactory WCF Net.Pipe 即使定义了CallbackBehavior属性,WCF服务也会阻止UI线程 - WCF service blocking the UI thread even though CallbackBehavior attribute is defined WCF中的基础架构和应用程序端点之间有什么区别(使用非专业术语)? - What is the difference between Infrastructure and application endpoints in WCF (in lay terms)? Window Presentation Foundation和WCF有什么区别? 哪个更新? - What is the difference between Window Presentation Foundation and WCF? Which is newer? Rest Web Service和启用了rest的wcf服务之间有什么区别? - What is the difference between Rest Web Service & rest enabled wcf service? 如何通过ServiceBehavior配置启用WCF帮助页面? - How to enable WCF help pages through ServiceBehavior configuration? 使用 .svc 文件和在“WCF 服务主机”中托管 WCF 服务有什么区别? - What is the difference between using a .svc file and hosting the WCF service in 'WCF Service Host'? WCF中BasicHttpBinding和NetHttpBinding之间的区别 - Difference between BasicHttpBinding and NetHttpBinding in WCF
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM