siliconplains
siliconplains

Reputation: 1

How do you set the maxreceivedmessagesize wcf setting in code on a wcf service with no config file that is hosted in IIS

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

Answers (2)

Eren Ersönmez
Eren Ersönmez

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

Sajeetharan
Sajeetharan

Reputation: 222722

Try with this piece of code,

BasicHttpBinding binding = proxy.Endpoint.Binding as BasicHttpBinding;
binding.MaxReceivedMessageSize = 20000000;

Upvotes: 2

Related Questions