dferraro
dferraro

Reputation: 6427

RequestEntityTooLarge with WCF OData client

I have a WCF Entity Service using the Microsoft.Data.OData services, hosted in IIS with a WinForms client.

I am querying the client from a WinForms desktop application and also doing updates and deletes. Everything works just fine until the data size reaches a certain point - I think it's 64k, and then I receive the 'RequestEntityTooLarge' error when I try to SaveChanges() on the client.

I did google and search here and found I was supposed to increase the maxReceiveMessageSize on my server config. I have done that, and several other things to no avail. The message still fails once over the certain size.

Here is the web.config for my service:

  <system.web>
    <compilation debug="true" targetFramework="4.5" />
    <httpRuntime targetFramework="4.5" maxRequestLength="2147483647" />
  </system.web>
    <bindings>
      <basicHttpBinding>
        <binding maxBufferPoolSize="2147483647" maxBufferSize="2147483647"
          maxReceivedMessageSize="2147483647" />
      </basicHttpBinding>
    </bindings>

Here is the config on the client:

<bindings>
  <basicHttpBinding>
    <binding maxBufferPoolSize="2147483647" maxBufferSize="2147483647"
      maxReceivedMessageSize="2147483647" />
  </basicHttpBinding>
</bindings>

On the client, I instantiate it very simply like this:

            _context = new Notification_Entities(new Uri(_oDataServiceURL));

And It fails when I call this:

 _context.SaveChanges();

Thanks for any help!!

Upvotes: 1

Views: 631

Answers (1)

Aron
Aron

Reputation: 15772

Microsoft.Data.OData has absolutely nothing to do with any of the <bindings /> settings. <httpRuntime maxRequestLength="x" /> is going to help. This will increase the .net limits. However there is another upload limit on IIS.

You will need to up the IIS limits with the following.

<system.webServer>
    <security>
        <requestFiltering>
            <requestLimits maxAllowedContentLength="2000000000" />
        </requestFiltering>
    </security>
</system.webServer>

Upvotes: 1

Related Questions