In my WCF I have a few services. One of them must have a bigger limit for message size so i must create another binding and change configuration.
But... i can't see any configuration of my services in Web.config - nothing. Something is default? So where I can change service binding?
Best How To :
In WCF 4.0+ the concept of default bindings and endpoints was introduced. If you create a new WCF Service Application, for example, out of the box with no changes you will get a default endpoint listening at the URI of the service using
basicHttpBinding (the default binding for
If you need larger values than the default values for binding configuration, you have two choices:
Make a default binding configuration section. This is done by omitting the
name attribute from the binding, like this:
<binding maxReceivedMessageSize="528880" />
Note there is no
name attribute (the other attributes have been omitted for purposes of the illustration). The configuration you specified is will be used as the default for any request that comes in over http and uses
Create the configuration as in step 1, but use the
name attribute and then assign that binding configuration to an explicit endpoint using the
bindingConfig attribute, like this:
<binding name="MyBinding" maxReceivedMessageSize="528880" />
<endpoint address="" bindingConfiguration="MyBinding" binding="basicHttpBinding" contract="MyService.IMyContract" />
The second example will assign the "MyBinding" configuration to the defined endpoint.
If you want to use something other than
basicHttpBinding for http requests, then you can also change the protocol mapping as shown in Neel's answer.
You can also check out A Developer's Introduction to Windows Communication Foundation 4 for more information on the default bindings/endpoints/etc introduced in WCF 4.0