Yes, there is. Look add the behavior in
<system.serviceModel>
<behaviors>
<endpointBehaviors>
<behavior>
<customBehavior />
</behavior>
</endpointBehaviors>
</behaviors>
<extensions>
<add name="customBehavior" type="..." />
</extensions>
</system.serviceModel>
You will need a class that inherits from BehaviorExtensionElement and that
is the type registered in the extensions element...
Hope this helps,
Carlos
"belochka" wrote:
Quote:
> Hi guys,
>
> We have a WCF service accepting requests with custom context object in SOAP
> header coming from the client. For this purpose we did the following:
>
> 1) On Server Side - applied custom attribute to contract interface (or
> service behavior attribute to service class).
>
> 2) On Client Side - we ether use app.config to apply custom endpoint
> behavior or physically edit generated proxy file and apply custom contract
> attribute to proxy interface.
>
> I.e. everything is as MSDN says.
>
> Now, the question is: Is it possible to make client apply the custom
> behavior AUTOMATICALLY without any physical app.config modification or
> physical coding in generated proxy file? It would be really nice to just
> "consume" the service with standard VS2008 "add service reference"
> functionality and it would support my custom header object insertion
> automatically, without any need of client coding.
>
> I guess there should be something custom in service generated wsdl that
> would tell my client to add extra attribute to generated proxy contract
> interface ...
>
> I.e. instead of having the following in generated proxy reference:
>
> ------ Code Snippet ------
> [GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")]
> [ServiceContractAttribute(ConfigurationName="PaymentServiceReference.PaymentService")]
> public interface IPaymentService
> {
> // method prototypes ...
> }
> -----------------------------
>
> I want to have something like:
>
> ------ Code Snippet ------
> [GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")]
> [ServiceContractAttribute(ConfigurationName="PaymentServiceReference.PaymentService")]
> [InsertCustomContextContractBehaviorAttribute] // <--- this one is required
> !!!
> public interface IPaymentService
> {
> // method prototypes ...
> }
> -----------------------------
>
> with extra attribute.
>
> Does anyone know how i can achieve this? May be there is a way to
> automatically generate something in app.config instead of applying custom
> attribute?
>
> Thanks,
> Belochka.
>
>