In WCF can you re-use endpoint behaviors, service behaviors and bindings? Or must each service / endpoint have distinct ones even if they are the same except for their ID.
You can reuse them - just specify the appropriate one(s) (via the name you gave them in their section) for the endpoints in question.
For example, assume you have a service behavior named "MyServiceBehavior", a wsHttpBinding named "MyWsHttpBinding" and an endpoint behavior named "MyEndpointBehavior".
For the service behavior, you'd use the behaviorConfiguration
attribute (behaviorConfiguration="MyServiceBehavior"
) in the <service>
element.
For the binding and endpoint behavior, you'd use the bindingConfiguration
attribute (bindingConfiguration="MyWsHttpBinding"
) and the behaviorConfiguration
attribute (behaviorConfiguration="MyEndpointBehavior"
) of the <endpoint>
element.