0

I know that this question has been asked a ton of times, but I have unfortunately not been able to adapt the answers into a working solution.

I have a WCF service, running in the IIS, that throws a 413 exception when I try to send requests that exceed 64KB in size. From all the research I have done it should be enough to set the maxReceivedMessageSize. The problematic service is the Validation service. I am trying to send an object with attachments that have been base64 encoded into a byte[].

I am running this in a VM running Windows Server 2019 Standard, but this problem is also present in other environments.

I have posted pastebin links to the stacktrace, Web.config, and the App.config to not explode size of the post.

Stacktrace https://pastebin.com/zbSF0nfB

Web.config snippet

<binding name="BasicHttpBinding_IValidationService" maxBufferPoolSize="2147483647"
      maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
      <readerQuotas maxDepth="2000000" maxStringContentLength="2147483647"
        maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
      <security mode="Transport">
        <transport clientCredentialType="Ntlm" />
      </security>
    </binding>

https://pastebin.com/V5TRBFsQ

App.config https://pastebin.com/Hr7NcBTJ

I hope that someone is able to find a mistake that I have made :)

  • You can try [configuring tracing](https://learn.microsoft.com/en-us/dotnet/framework/wcf/diagnostics/tracing/configuring-tracing) for more details. – Lan Huang Jul 05 '22 at 05:54
  • In addition to increasing the message size and buffer size quotes, consider increasing the serializer's `maxItemsInObjectGraph`.For details please see:https://stackoverflow.com/a/32986766/17218587 – Lan Huang Jul 05 '22 at 06:06
  • Changing the message and buffer size and setting the maxItemsInObjectGraph does not seem to have fixed the issue. I have tried to add tracing but it does not seem to provide any extra information from what I already had. I have gone through the Configuration editor for IIS sites and ensured these settings are set. – Frederik Andersen Jul 06 '22 at 07:47

1 Answers1

0

The solution was found in this post (How to override WebServiceHostFactory MaxReceivedMessageSize?)

The problem was the factory creating the host for the service, because it was a default SharePoint factory/host it did not respond to the changes made in the different web.config files. The solution was therefore to replace the factories with custom factories that created the hosts with the parameters that would normally be specified in the web.config files.