exchange web services: export item which larger than 2GB got 400 with empty response

27 Views Asked by At

I am writing a exchange client to backup and restore emails. using ews api. using python3 urllib send xml format (soap) http post body. The Authentication Method is ntlm. The exchange server is exchange 2016, IIS version is IIS 10.

The Ews apis I am using are: ExportItems and UploadItems.

There are some emails which are extreme large, eg. 2GB. I can export email by ExportItems, but I cannot upload with UploadItems it. server response is HTTP 400 Bad Request with empty body. The configuration and detail are as follows:

EWS Configuration was changed as this:

maxAllowedContentLength changed to the uint32 maximum 4294967295 (4294967295 bytes = 4GB) maxRequestLength changed to 3000000 (3000000 kB > 4GB) maxReceivedMessageSize changed to 4294967295 (4294967295 bytes = 4GB)

C:\Windows\System32\inetsrv\appcmd.exe set config "Default Web Site/ews/" -section:system.webServer/security/requestFiltering /requestLimits.maxAllowedContentLength:4294967295
C:\Windows\System32\inetsrv\appcmd.exe set config "Exchange Back End/ews/" -section:system.webServer/security/requestFiltering /requestLimits.maxAllowedContentLength:4294967295
C:\Windows\System32\inetsrv\appcmd.exe set config "Exchange Back End/ews/" -section:system.serviceModel/bindings /customBinding."[name='EWSAnonymousHttpsBinding']".httpsTransport.maxReceivedMessageSize:4294967295
C:\Windows\System32\inetsrv\appcmd.exe set config "Default Web Site/ews/" -section:system.web/httpRuntime /maxRequestLength:3000000
C:\Windows\System32\inetsrv\appcmd.exe set config "Exchange Back End/ews/" -section:system.web/httpRuntime /maxRequestLength:3000000
C:\Windows\System32\inetsrv\appcmd.exe set config "Exchange Back End/ews/" -section:system.serviceModel/bindings /customBinding."[name='EWSAnonymousHttpBinding']".httpTransport.maxReceivedMessageSize:4294967295
C:\Windows\System32\inetsrv\appcmd.exe set config "Exchange Back End/ews/" -section:system.serviceModel/bindings /customBinding."[name='EWSBasicHttpsBinding']".httpsTransport.maxReceivedMessageSize:4294967295
C:\Windows\System32\inetsrv\appcmd.exe set config "Exchange Back End/ews/" -section:system.serviceModel/bindings /customBinding."[name='EWSBasicHttpBinding']".httpTransport.maxReceivedMessageSize:4294967295
C:\Windows\System32\inetsrv\appcmd.exe set config "Exchange Back End/ews/" -section:system.serviceModel/bindings /customBinding."[name='EWSNegotiateHttpsBinding']".httpsTransport.maxReceivedMessageSize:4294967295
C:\Windows\System32\inetsrv\appcmd.exe set config "Exchange Back End/ews/" -section:system.serviceModel/bindings /customBinding."[name='EWSNegotiateHttpBinding']".httpTransport.maxReceivedMessageSize:4294967295
C:\Windows\System32\inetsrv\appcmd.exe set config "Exchange Back End/ews/" -section:system.serviceModel/bindings /customBinding."[name='EWSWSSecurityHttpsBinding']".httpsTransport.maxReceivedMessageSize:4294967295
C:\Windows\System32\inetsrv\appcmd.exe set config "Exchange Back End/ews/" -section:system.serviceModel/bindings /customBinding."[name='EWSWSSecurityHttpBinding']".httpTransport.maxReceivedMessageSize:4294967295
C:\Windows\System32\inetsrv\appcmd.exe set config "Exchange Back End/ews/" -section:system.serviceModel/bindings /customBinding."[name='EWSWSSecuritySymmetricKeyHttpsBinding']".httpsTransport.maxReceivedMessageSize:4294967295
C:\Windows\System32\inetsrv\appcmd.exe set config "Exchange Back End/ews/" -section:system.serviceModel/bindings /customBinding."[name='EWSWSSecuritySymmetricKeyHttpBinding']".httpTransport.maxReceivedMessageSize:4294967295
C:\Windows\System32\inetsrv\appcmd.exe set config "Exchange Back End/ews/" -section:system.serviceModel/bindings /customBinding."[name='EWSWSSecurityX509CertHttpsBinding']".httpsTransport.maxReceivedMessageSize:4294967295
C:\Windows\System32\inetsrv\appcmd.exe set config "Exchange Back End/ews/" -section:system.serviceModel/bindings /customBinding."[name='EWSWSSecurityX509CertHttpBinding']".httpTransport.maxReceivedMessageSize:4294967295
C:\Windows\System32\inetsrv\appcmd.exe set config "Exchange Back End/ews/" -section:system.serviceModel/bindings /webHttpBinding."[name='EWSStreamingNegotiateHttpsBinding']".maxReceivedMessageSize:4294967295
C:\Windows\System32\inetsrv\appcmd.exe set config "Exchange Back End/ews/" -section:system.serviceModel/bindings /webHttpBinding."[name='EWSStreamingNegotiateHttpBinding']".maxReceivedMessageSize:4294967295

I tried as follows:

  1. Since exchange server using HTTP 1.1 Transfer-Encoding: chunked response header to response when I use ExportItems. I suggest that request can also use this. But even if I send valid data to server with Transfer-Encoding: chunked, the server give me a HTTP 1.1 400 Bad Request with no response data?

the ews api don't support Transfer-Encoding: chunked request? If anyone succeed using Transfer-Encoding: chunked ews api, please share to me.

  1. using Content-Length. but when I set Content-Length larger than 2GB, e.g. set Content-Length: 2247483648 which larger than 2,147,483,648. The server give me a HTTP 1.1 400 Bad Request with no response data.

but use Content-Length < 2GB is OK. Is there another configuration controll the 2GB limit?

0

There are 0 best solutions below