Quantcast
Channel: VBForums - WPF, WCF, WF
Viewing all articles
Browse latest Browse all 256

[RESOLVED] The remote server returned an error: (413) Request Entity Too Large.

$
0
0
Hi Guys

I've implemented a small set of REST services using WCF. One of the services recieves a large amount of data. When calling it (this is when runnig it from visual studio - I haven't deployed itto a production server yet) I get the error:-
The remote server returned an error: (413) Request Entity Too Large.

I've been doing some reading on t'internet and I gather this is because the default server that runs is set to reject large request to help prevent DOS attacks. That makes sense but I need to increase the size to cope with my request. This will ultimately go an an intranet so DOS attacks aren't a major concern. Anyway, from what I've read on the net I've ended up adding the following to my Web.Config:-
Code:

<bindings>
      <basicHttpBinding>
        <binding maxReceivedMessageSize="2147483647"
                maxBufferSize="2147483647"
                maxBufferPoolSize="2147483647">
          <readerQuotas maxDepth="32"
                        maxArrayLength="2147483647"
                        maxStringContentLength="2147483647"/>
        </binding>
      </basicHttpBinding>
    </bindings>

...but that hasn't worked. Is there anything wrong with that or is there something else I should be doing? Any advice?




Here's the full web config in case the problem is elsewhere:-
Code:

<?xml version="1.0"?>
<configuration>
  <system.diagnostics>
    <sources>
      <source name="System.ServiceModel" switchValue="Information, ActivityTracing" propagateActivity="true">
        <listeners>
          <add name="traceListener" type="System.Diagnostics.XmlWriterTraceListener" initializeData="c:\Temp\Traces.svclog" />
        </listeners>
      </source>
    </sources>
  </system.diagnostics>
  <system.web>
    <compilation debug="true" targetFramework="4.0" />
  </system.web>
  <system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding maxReceivedMessageSize="2147483647"
                maxBufferSize="2147483647"
                maxBufferPoolSize="2147483647">
          <readerQuotas maxDepth="32"
                        maxArrayLength="2147483647"
                        maxStringContentLength="2147483647"/>
        </binding>
      </basicHttpBinding>
    </bindings>
    <behaviors>
      <serviceBehaviors>
        <behavior name="">         
          <serviceMetadata httpGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="false" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true"
      multipleSiteBindingsEnabled="true" />
    <standardEndpoints>
      <webHttpEndpoint>
        <standardEndpoint name="" helpEnabled="true" automaticFormatSelectionEnabled="true"></standardEndpoint>
      </webHttpEndpoint>
    </standardEndpoints>
  </system.serviceModel>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
  </system.webServer> 
</configuration>



edit> It's worth mentioning that I'm way out of my comfort zone here. The chances of me having done something completely bone-headed are high.

Viewing all articles
Browse latest Browse all 256

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>