i had wcf service
my web.config looks this:
<system.servicemodel> <bindings> <webhttpbinding> <binding name="crossdomain" crossdomainscriptaccessenabled="true" /> </webhttpbinding> </bindings> <behaviors> <servicebehaviors> <behavior name="servicebehavior"> <!-- avoid disclosing metadata information, set value below false , remove metadata endpoint above before deployment --> <servicemetadata httpgetenabled="true"/> <!-- receive exception details in faults debugging purposes, set value below true. set false before deployment avoid disclosing exception information --> <servicedebug includeexceptiondetailinfaults="true"/> </behavior> </servicebehaviors> <endpointbehaviors> <behavior name="endpbehavior"> <webhttp /> </behavior> </endpointbehaviors> </behaviors> <services> <service behaviorconfiguration="servicebehavior" name="mynamespace.myservice"> <endpoint address="" binding="webhttpbinding" bindingconfiguration="crossdomain" contract="mynamespace.imyservice" behaviorconfiguration="endpbehavior"/> </service> </services> <servicehostingenvironment multiplesitebindingsenabled="true" /> i found code array parameter 1 of website
using system.servicemodel.description; using system.servicemodel.dispatcher; using system.servicemodel.web; namespace arraysinquerystrings { public class arrayinquerystringwebhttpbehavior : webhttpbehavior { webmessageformat defaultoutgoingresponseformat; public arrayinquerystringwebhttpbehavior() { this.defaultoutgoingresponseformat = webmessageformat.json; } public override webmessageformat defaultoutgoingresponseformat { { return this.defaultoutgoingresponseformat; } set { this.defaultoutgoingresponseformat = value; } } protected override querystringconverter getquerystringconverter(operationdescription operationdescription) { return new arrayquerystringconverter(); } } } how use extended class in web.config.
it seems endpoint behaviour dont know how use it.
any appreciated
to add custom behaviors, need add derived behavior behavior extension in config file , need add new behavior extension type. refer post - custom behavior won't register in web.config
public class arrayinquerystringbehaviorextension : behaviorextensionelement { public override type behaviortype { { return typeof(arrayinquerystringwebhttpbehavior); } } protected override object createbehavior() { return new arrayinquerystringwebhttpbehavior(); } } config file (you need specify assembly name have marked square brackets below)
<extensions> <behaviorextensions> <add name=" arrayinquerystringwebhttpbehavior " type="[namespace]. arrayinquerystringbehaviorextension, [assembly name], [assembly version], [assembly culture], publickeytoken=null" /> </behaviorextensions> </extensions> <behaviors> <endpointbehaviors> <behavior name="arrayinquerybehavior"> <webhttp/> < arrayinquerystringwebhttpbehavior /> </behavior> </endpointbehaviors> <behaviors>
Comments
Post a Comment