WCF maxReceivedMessageSize not recognized when deployed to server

18 views Asked by At

I have a WCF service that receives XML files, but responds with "HTTP/1.1 413 Request Entity Too Large" when the files are larger than the default 64KB on the server.

Running locally, it accepts large files by adding a maxReceivedMessageSize value to basicHttpBinding but the properties just aren't being used when deployed to the server.

It's a 2022 server running IIS 10, and the project is using .NET 4.7.2

I've tried adding more configurations to the web.config file from examples I've found online, including services and <service> and <endpoint>:

<system.serviceModel>
    <services>
        <service name="ServiceNamespace.IService">
          <endpoint binding="basicHttpBinding"
                    bindingConfiguration="default"
                    contract="ServiceNamespace.IService"/>
        </service>
    </services>
    <bindings>
        <basicHttpBinding>
            <binding maxReceivedMessageSize="1000000"
                maxBufferSize="1000000"
                maxBufferPoolSize="1000000">
                <readerQuotas maxDepth="32" maxStringContentLength="2000001"
                    maxArrayLength="2000001" maxBytesPerRead="2000001" maxNameTableCharCount="2000001" />
            </binding>
        </basicHttpBinding>
    <webHttpBinding>
        <binding maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" />
    </webHttpBinding>
    </bindings>
    <behaviors>
        <serviceBehaviors>
            <behavior>
              <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
              <serviceDebug includeExceptionDetailInFaults="true" />
            </behavior>
        </serviceBehaviors>
    </behaviors>
    <protocolMapping>
      <add binding="basicHttpsBinding" scheme="https" />
      <add binding="basicHttpBinding" scheme="http" />
    </protocolMapping>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
</system.serviceModel>

I realistically only need the maxReceivedMessageSize to be around 3KB, but have bumped it up to 1MB in hopes it would work.

0

There are 0 answers