0

I am having problems calling a wcf service from an asp.net application / console application. The error I am getting is "The remote server returned an error: (413) Request Entity Too Large."

Both web.config and app.config have the following lines:

    <system.serviceModel>
    <bindings>
    <basicHttpBinding>
    <binding name="BasicHttpBinding_IWCLService" maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" messageEncoding="Text">
    <readerQuotas maxDepth="2000000" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
    </binding>
    </basicHttpBinding>
    </bindings>
    <client>
    <endpoint address="http://[server]/[projectname].wcfservice/WCLService.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IWCLService" contract="wclSvc.IWCLService" name="BasicHttpBinding_IWCLService" />
    </client>
    </system.serviceModel>

This is the web.config of the wcf service itself:

    <?xml version="1.0" encoding="UTF-8"?>
     <configuration>
      <appSettings>
       <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
      </appSettings>
      <system.web>
       <compilation debug="true" targetFramework="4.6" />
       <httpRuntime maxRequestLength="104857600" targetFramework="4.6" />
       <customErrors mode="Off" />
      </system.web>
      <system.serviceModel>
       <behaviors>
        <serviceBehaviors>
         <behavior>
          <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="false" />
         </behavior>
        </serviceBehaviors>
       </behaviors>
       <protocolMapping>
        <add binding="basicHttpsBinding" scheme="https" />
       </protocolMapping>    
       <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
      </system.serviceModel>
      <system.webServer>
       <modules runAllManagedModulesForAllRequests="true" />
        <directoryBrowse enabled="true" />
        <staticContent>
         <mimeMap fileExtension=".svc" mimeType="application/octet-stream" />
        </staticContent>
        <handlers>
         <add name="svc-integrated" path="*.svc" verb="*" type="System.ServiceModel.Activation.HttpHandler" resourceType="File" preCondition="integratedMode" />
        </handlers>
        <security>
         <requestFiltering>
            <requestLimits maxAllowedContentLength="104857600" />
         </requestFiltering>
        </security>
     </system.webServer>

    </configuration>
VinceV
  • 37
  • 5

1 Answers1

0

Check the read ahead byte setting. Check out the answer to a similar issue:

IIS7 - (413) Request Entity Too Large | uploadReadAheadSize

If you find Tom P's or another's answer has helped you, be sure to vote up his/her answer. Giving credit where credit is due.

Community
  • 1
  • 1
J Man
  • 179
  • 1
  • 10