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.
Asked
Active
Viewed 445 times
2
-
You're not "re-using" them as such because in your config they're not an object, they're simply a definition. – slugster Aug 03 '18 at 01:54
1 Answers
2
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.