DreamTimeStudioZ
DreamTimeStudioZ

Reputation: 586

WCF REST POST operation throwing 413 (Entity Too Large) error

I've created, using the built-in project template, a WCF REST-based service. Everything works just great except that when I attempt to "POST" a file (as a stream) to one of my operations, I'm consistently getting a 413 (Entity Too Large) response.

I've looked at all the other 413 questions related to WCF and they're all related to non-REST services and/or IIS6 configurations and mention either the <system.Web> or <binding>properties.

Any ideas?

Upvotes: 9

Views: 7026

Answers (4)

DreamTimeStudioZ
DreamTimeStudioZ

Reputation: 586

Well... I figured it out!

It turns out that the setting which worked is one which has to be applied to the standardEndpoint node inside system.serviceModel node:

<system.serviceModel>
    <standardEndpoints>
        <webHttpEndpoint>
            <standardEndpoint name=""
                 helpEnabled="true"
                 automaticFormatSelectionEnabled="true"
                 maxReceivedMessageSize="2147000000"
                 />
        </webHttpEndpoint>
    </standardEndpoints>
</system.serviceModel>

Upvotes: 12

Brian H
Brian H

Reputation: 4110

I had seemingly the same issue and ended up having to create a custom binding for my RESTful service and increase the maxReceivedMessageSize setting.

  <webHttpBinding>
    <binding name="RESTfulServiceBinding" maxReceivedMessageSize="50000000" />
  </webHttpBinding>

Upvotes: 2

Steven Licht
Steven Licht

Reputation: 770

Check the quotas and max's in your config file maxmessagesize, etc. defaults are 8192, 16384, 65536

Upvotes: 2

cdeszaq
cdeszaq

Reputation: 31280

I would check the max upload size set in IIS. In the past, that has been the issue when I have tried to post files. It is usually set too small for any application that actually needs to deal with file uploads.

Upvotes: 1

Related Questions