Geeks With Blogs
Koushal Deshpande kd

In BizTalk for WCF end point, we get both ServiceBehavior and EndPointBehavior as behavior extensions. Then a question comes across to mind is, why two different behaviors when we can use single service or end point one? Found out the answer, thanks to different sources and blogs. I haven't used WCF Services as such, so needed a clear answer for this.

The ApplyDispatchBehavior method on IServiceBehavior has access to all endpoints and their runtime components and so shouldn't that be enough for wiring up customization? The short answer is yes, but there are subtle differences.

 Some usability differences are

1. ServiceBehavior applies only on service while EndpointBehavior applies on both client and service.

2. ServiceBehavior can be specified via config/attribute/code while endpointbehavior can be specified via config/code.

 3. 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.

And of course there is the biggest difference, if you want to customize endpoints on client then the only option is IEndpointBehavior.

The Contract specifies what the service actually does. In other words, what Operations are valid.

The Endpoint specifies an actual running instance of the service. It is the actual "service" in the sense that it executes, either as a Windows Service or under IIS.

The Service Behavior defines how the endpoint interacts with clients. Attributes like security, concurrency, caching, logging, etc. - those are all part of the behavior.

There is also an Operation Behavior which is similar to the Service Behavior but only gets applied when a specific operation is run.

Posted on Friday, November 8, 2013 5:36 PM BizTalk , WCF , End Point , Service Behavior | Back to top

Comments on this post: Difference between ServiceBehavior and EndPointBehavior

No comments posted yet.
Your comment:
 (will show your gravatar)

Copyright © Koushal Deshpande | Powered by: