Reputation: 1
I have inherited a project that contains a set of wcf services that is hosted in iis with no config file entries. I need to increase the maxreceivedmessagesize wcf setting. How would I do this in code?
Upvotes: 0
Views: 1883
Reputation: 39095
For future reference, you can add this in your web.config (as @Tim suggested in the comments). Note that the basicHttpBinding doesn't have a name specified, so it becomes the default config for that binding type.
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding maxReceivedMessageSize="2147483647"/>
</basicHttpBinding>
</bindings>
</system.serviceModel>
Upvotes: 0
Reputation: 222722
Try with this piece of code,
BasicHttpBinding binding = proxy.Endpoint.Binding as BasicHttpBinding;
binding.MaxReceivedMessageSize = 20000000;
Upvotes: 2