WCF - How to configure Site-level web.config and make all services use a same behaviorConfiguration
-
05-10-2019 - |
Question
I have a site that host more then 60 services.
With the simplified version of the wcf configuration, i dont have to speficy all the services and its corresponding endpoints.
The question is how do I speficy the service host to use the same behaviorConfiguration for all servies endpoint ?
I don't want to list all the endpoints in the web.config and speficy the behaviorConfiguration on each of them. I want all of the wcf services hosted on that virtual directory to use the same behaviorConfiguration. Any way to do this ?
Solution
I found the answer. I just need to remove the name for my endpointBehaviors
From this :
<behaviors> ... <endpointBehaviors> <behavior name="MyCustomBehavior"> <myCustomExt/> </behavior> </endpointBehaviors> ... </behaviors>
To this :
<behaviors> ... <endpointBehaviors> <behavior> <myCustomExt/> </behavior> </endpointBehaviors> ... </behaviors>
See here for more details Setting Configuration Defaults with Nameless Elements in WCF 4
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow