Home > Blockchain >  Receiving Request Entity Too Large Error Even after updating the UploadReadAheadSize
Receiving Request Entity Too Large Error Even after updating the UploadReadAheadSize

Time:09-17

My WCF service is exposed to receive XML files as part of the request(Using SOAP UI for testing purposes). After enabling Certificate-based authentication for the service endpoint, IIS was throwing HTTP/1.1 413 Request Entity Too Large error. To resolve this issue, Updated the value of uploadReadAheadSize to ‘20000000’ in the IIS config. The service was able to process the request successfully after the config change, and on that time the size of the files received from the client was around 10MB. But later, the same issue is observed and found that the request now has XML files having sizes varying from 15 MB to 30MB. To fix this issue increases the uploadReadAheadSize to '90000000'(tried with higher values). But this issue persisting. Any suggestions to fix this issue?

Current service configuration :

<bindings>
    <basicHttpsBinding>
        <binding name="BasicHttpBinding.MyService" transferMode="Streamed" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" messageEncoding="Mtom" receiveTimeout="00:30:00">
            <readerQuotas maxStringContentLength="2147483647" maxBytesPerRead="2147483647" maxDepth="2147483647" maxArrayLength="2147483647" />
            <security mode="Transport">
                <transport clientCredentialType="Certificate" />
            </security>
        </binding>
    </basicHttpsBinding>
</bindings>
<behaviors>
    <serviceBehaviors>
        <behavior name="MyTestProjectIntegrationServiceBehavior">
            <serviceCredentials>
                <serviceCertificate findValue="****************************" storeLocation="LocalMachine" storeName="My" x509FindType="FindByThumbprint" />
            </serviceCredentials>
            <serviceMetadata httpsGetEnabled="true" />
            <CustomBehaviorExtensionElement />
            <serviceDebug includeExceptionDetailInFaults="true" />
        </behavior>
    </serviceBehaviors>
    <endpointBehaviors>
        <behavior name="MyServiceEndpointBehavior">
            <MyServiceSchemaValidator validateRequest="True" validateReply="False">
                <schemas>
                    <add location="App_Data\MyTestProjectXsd\exchange-model-service.xsd" />
                </schemas>
            </MyServiceSchemaValidator>
        </behavior>
    </endpointBehaviors>
</behaviors>
<system.serviceModel>
    <services>
        <service name="Test.Project.ServiceImplementation.MyService" behaviorConfiguration="MyTestProjectIntegrationServiceBehavior">
            <endpoint binding="basicHttpsBinding" bindingConfiguration="BasicHttpBinding.MyService" contract="ExchangeMyProjectService" behaviorConfiguration="MyServiceEndpointBehavior" bindingNamespace="http://www.test.com/api/end/service" />
        </service>
    </services>
</system.serviceModel>

CodePudding user response:

The actual cause of this issue is request size. Some of the requests are crossing 30MB and resulting in this error. To resolve this issue, updated the maxAllowedContentLength(system.webServer/security/requestFiltering) of IIS to 50MB, by default it is 30000000(30MB)

  • Related