c# - How to change default WCF service binding? -


in wcf have few services. 1 of them must have bigger limit message size must create binding , change configuration.

but... can't see configuration of services in web.config - nothing. default? can change service binding?

in wcf 4.0+ concept of default bindings , endpoints introduced. if create new wcf service application, example, out of box no changes default endpoint listening @ uri of service using basichttpbinding (the default binding http).

if need larger values default values binding configuration, have 2 choices:

make default binding configuration section. done omitting name attribute binding, this:

<system.servicemodel>   <bindings>     <basichttpbinding>       <binding maxreceivedmessagesize="528880" />     </basichttpbinding>   </bindings> <system.servicemodel> 

note there no name attribute (the other attributes have been omitted purposes of illustration). configuration specified used default request comes in on http , uses basichttpbinding.

create configuration in step 1, use name attribute , assign binding configuration explicit endpoint using bindingconfig attribute, this:

<system.servicemodel>   <bindings>     <basichttpbinding>       <binding name="mybinding" maxreceivedmessagesize="528880" />     </basichttpbinding>   </bindings>   <services>     <service name="myservice">       <endpoint address="" bindingconfiguration="mybinding" binding="basichttpbinding" contract="myservice.imycontract" />     </service>   </services> <system.servicemodel>  

the second example assign "mybinding" configuration defined endpoint.

if want use other basichttpbinding http requests, can change protocol mapping shown in neel's answer.

you can check out a developer's introduction windows communication foundation 4 more information on default bindings/endpoints/etc introduced in wcf 4.0


Comments

Popular posts from this blog

java - Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved -

Round ImageView Android -

How can I utilize Yahoo Weather API in android -