Custom MTOM binding and Max upload size

2019-07-31 03:35发布

问题:

I'm using the binding configuration below for my upload service,

<binding name="FileUploadSTSBinding">
          <security authenticationMode="UserNameOverTransport"
                    requireDerivedKeys="false"
                    keyEntropyMode="ServerEntropy"
                    requireSecurityContextCancellation="false"
                    requireSignatureConfirmation="false">
          </security>
          <mtomMessageEncoding/>
          <httpsTransport 
            transferMode="Streamed" 
            maxReceivedMessageSize="2147483647"/>
        </binding>

But with this setting, I'm not able to upload big files like more than 1mb, server response is bad request.

Any thoughts?

回答1:

You need to set the maxRequestLength attribute as well for the upload to work. It can here found in the web.config file here:

<configuration>
   <system.web>
      <httpRuntime>

Check that the IIS app pool identity has the right to write to the temp folder to be able to temporarily store the incoming data.