我不确定我是否理解 web.config 元素之间的区别 <endpointBehaviors>
和<serviceBehaviors>
(当然还有邻近的行为)。
最佳答案
来自here :
ServiceBehavior applies only on service while EndpointBehavior applies on both client and service.
ServiceBehavior can be specified via config/attribute/code while endpointbehavior can be specified via config/code.
ServiceBehavior has access to all ServiceEndpoints dispatch runtime and so could modify all dispatch runtimes while Endpointbehavior gets called with the runtime for that endpoint only.
Look at it this way, ServiceBehavior lets you access runtime parameters for all endpoints while Endpointbehavior lets you access runtime components only for that endpoint. So if you have a need to extend functionality that spawns the entire contract (or multiple contracts) then use ServiceBehavior and if you are interested in extending one specific endpoint then use Endpointbehavior.
还有MSDN可以随时引用以获取详细信息:
<endpointBehaviors>
This configuration section represents all the behaviors defined for a specific endpoint.
<serviceBehaviors>
This configuration section represents all the behaviors defined for a specific service.
一个很好的 MSDN 引用:Configuring and Extending the Runtime with Behaviors
关于asp.net - <endpointBehaviors> 和 <serviceBehaviors> 之间的区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34526228/