none
Defining ServiceBahavior in .cs and .config file... RRS feed

  • Question

  • HI,

       I was going through the service behavior and Operation Behavior attributes in my service.  If I create a ServiceBehavior in my .cs page, I could see the following attributes.


    • AddressFilterMode
    • AutomaticSessionShutdown
    • ConcurrencyMode  

    and many more...

    But if I create my service Behavior in my config file, I couldnt see these attributes.

    • ServiceMetadata
    • ServiceCredentials
    • Service Debug etc..

    What I need to do if I need to set ServiceMetadata in my .cs page or if I need to set my ConcurrencyMode in my config file.

    Similarly for the properties in operationBehavior..

    Or am I missing something. kindly explain.

    Thanks,

    Sanjay.




    Tuesday, June 10, 2014 3:22 PM

Answers

  • Hi,

    >>What I need to do if I need to set ServiceMetadata in my .cs page

    We can set the ServiceMetadata in the .CS code, for example I want to write the following:
    <serviceMetadata httpGetEnabled="true"/>

    Then the .CS code will be:

    ServiceMetadataBehavior smb = new ServiceMetadataBehavior();
    smb.HttpGetEnabled = true;
    

    >>if I need to set my ConcurrencyMode in my config file.

    We can not do that. These settings typically interact with how the app is written (e.g. is the service class written to allow for multiple threads, one thread or reentrant calls?) so the developer must use code (e.g. ServiceBehaviorAttribute) to change these settings.

    Best Regards,
    Amy Peng


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, June 11, 2014 9:03 AM
    Moderator