5
votes

May be this question is a duplicate. I have a WCF upload service through which the client uploads a particular file to the server.

I could successfully send files of size 12MB through the service.

Now I have integrated a self certified SSL certificate to the WCF Service. The same application which was working fine without SSL now returns an error saying Remote server returned an error (413) request entity too large.

how do I fix this error is this something to do with SSL ?

where am I going wrong.

<system.serviceModel>

<bindings>
  <basicHttpBinding>
    <binding name="customHttpBinding" openTimeout="00:10:00" sendTimeout="00:10:00"
     maxReceivedMessageSize="10067108864"
      messageEncoding="Mtom" transferMode="Streamed">          
      <security mode="Transport">
        <transport clientCredentialType="Certificate" />
      </security>
    </binding>
  </basicHttpBinding>
</bindings>

<behaviors>
  <serviceBehaviors>
    <behavior name="customServiceBehavior">
      <serviceMetadata httpsGetEnabled="true"/>
      <serviceDebug includeExceptionDetailInFaults="true"/>

      <serviceCredentials>
        <clientCertificate>
          <authentication certificateValidationMode="PeerOrChainTrust" trustedStoreLocation="LocalMachine"/>
        </clientCertificate>
      </serviceCredentials>

    </behavior>
  </serviceBehaviors>
</behaviors>

<services>
  <service behaviorConfiguration="customServiceBehavior" name="FileTransferService">
    <endpoint address="" binding="basicHttpBinding" bindingConfiguration="customHttpBinding"
      contract="IFileTransferService" />
  </service>
</services>

thanks

1

1 Answers

6
votes

This seems to be the ticket to fixing the 413 Request Entity too large error with WCF over HTTPS

C:\Windows\System32\inetsrv>appcmd.exe set config "Default Web Site" -section:system.webServer/serverRunTime /uploadReadAheadSize:10485760 /commit:apphost

The reason seems to be related to how IIS handles authentication of incoming requests over SSL.

Another resource: http://blogs.msdn.com/b/jiruss/archive/2007/04/13/http-413-request-entity-too-large-can-t-upload-large-files-using-iis6.aspx

I just spent most of my afternoon tracking this problem down...many other suggestions didn't help me much but this certainly did, so hopefully this will get you fixed up.