Request entity too large Error(413)

I have an asp.net project that use a wcf on the server to save a file in the database. I am sending Json to the wcf.
this wcf work fine for small json file but when it come to a larger one it gives an error (My Json file is 150Kb ) :
 "Remote server returned an unexpected response :Error (413) Request entity is too large error".
I tried every solution found on the internet :
<bindings>
      <basicHttpBinding>
        <binding maxReceivedMessageSize="2147483647" 
                 maxBufferSize="2147483647"
                 maxBufferPoolSize="2147483647">
          <readerQuotas maxDepth="32"
                        maxArrayLength="2147483647"
                        maxStringContentLength="2147483647"/>
        </binding>
      </basicHttpBinding>
    </bindings>

Open in new window


and I tried configuring the iss UploadReadAheadSize  but it didn't work .
Any Idea how to solve this issue?
ProgrammerAtAIMSAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Rainer JeschorCommented:
Hi,
have you configured both the "client" side as well as the server (WCF service) side?
Is your WCF Service RESTful?
HTH
Rainer
0
ProgrammerAtAIMSAuthor Commented:
Hi,
Yes I have configured both side and my wcf service is RESTful.
0
Anil GolamariCommented:
You need to modify the configurations on both Service and Client as well. Are both have same configuration like maxbuffersize?

If you're still getting this error message while using the WCF Test Client, it's because the client has a separate MaxBufferSize setting. If not you can try below steps:

Right-Click on the Config File node and at the bottom of the tree
Select Edit with SvcConfigEditor
A list of editable settings will appear, including MaxBufferSize.

Note: Auto-generated proxy clients also set MaxBufferSize to 65536 by default.
0
Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

ProgrammerAtAIMSAuthor Commented:
Hi Anil Golamari i configured both service and client and maxbuffersize is set to "2147483647" in both .
in the edit with svcconfigeditor i have same properties that i already added in my webconfig code and set to the max.
Still not working.
Thank for your advice .
0
Ryan ChongCommented:
I'm recently facing this similar issue. the weird thing is that after I have done the configuration, I can use FileUpload control to upload large file, but not the Restful web service.

Is anyone found a solution here?
0
Ryan ChongCommented:
I resolved my own similar issue by doing the following settings:

1) Adding something similar below in web.config:
  <system.serviceModel>
    <bindings>
      <webHttpBinding>
        <binding
          maxBufferPoolSize="2147483647"
          maxReceivedMessageSize="2147483647"
          maxBufferSize="2147483647" transferMode="Streamed">
        </binding>
      </webHttpBinding>
    </bindings>
 </system.serviceModel>

Open in new window

2147483647 is equals to 2GB, hence we need to change it to proper size for Production site.

2) in IIS, update the settings of:

> Go to the site, file the Configuration Editor under “Management”
> Go to Sections in
    > system.webServer/security/authentication/anonymousAuthentication
    > system.webServer/security/authentication/windowsAuthentication
> Select ApplicationHost.config <location=’<site name>’ />
> Unlock the Section
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
WCF

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.