在 Exchange Server 中配置特定于客户端的消息大小限制

在Exchange Server中,有几种不同的邮件大小限制适用于邮件在组织中传递。 有关详细信息,请参阅 Exchange Server 中的邮件大小和收件人限制

但是,对于使用 Exchange ActiveSync 或 Exchange Web Services (EWS) 的Outlook 网页版 (以前称为Outlook Web App) 和电子邮件客户端,可以配置特定于客户端的邮件大小限制。 如果更改 Exchange 组织、连接器或用户邮件大小限制,可能需要更改Outlook 网页版、ActiveSync 和 EWS 的限制。 下表介绍了这些限制。 若要更改特定客户端类型的邮件大小限制,则需要更改此表中描述的 所有 值。

注意

对于任何邮件大小限制,您设置的值都必须大于要强制应用的实际邮件大小。 这样就可以对附件和其他二进制数据进行 Base64 编码了。 由于 Base64 编码会导致邮件大小增加约 33%,因此您指定的值应比要强制应用的实际邮件大小高出约 33%。 例如,如果您指定的最大邮件大小值为 64 MB,则可以预计实际最大邮件大小值约为 48 MB。

ActiveSync

服务 配置文件 键和默认值 Size
客户端访问(前端) %ExchangeInstallPath%FrontEnd\HttpProxy\Sync\web.config maxAllowedContentLength="30000000" (默认不存在;请参阅注释) 字节
客户端访问(前端) %ExchangeInstallPath%FrontEnd\HttpProxy\Sync\web.config maxRequestLength="10240" 千字节
后端 %ExchangeInstallPath%ClientAccess\Sync\web.config maxAllowedContentLength="30000000 bytes" (默认不存在;请参阅注释) 字节
后端 %ExchangeInstallPath%ClientAccess\Sync\web.config maxRequestLength="10240" 千字节
后端 %ExchangeInstallPath%ClientAccess\Sync\web.config <add key="MaxDocumentDataSize" value="10240000"> 字节

对 ActiveSync 限制的说明

默认情况下,ActiveSync 的web.config文件中没有 maxAllowedContentLength 键。 但是,ActiveSync 的最大消息大小受应用于服务器上所有网站的 maxAllowedContentLength 值的影响。 默认值为 30000000 字节。 若要在 IIS 管理器中查看邮箱服务器上的 ActiveSync 的这些值,请执行以下步骤:

  1. 请按照以下步骤之一操作:

    • 对于“客户端访问 (前端) 网站,请打开 IIS 管理器,导航到 ”站点>“”默认网站 “,然后选择” Microsoft-Server-ActiveSync”。

    • 对于后端网站,请打开 IIS 管理器,导航到 “站点>”“Exchange 后端 ”,然后选择“ Microsoft-Server-ActiveSync”。

  2. 验证是否已选择底部的“功能视图”选项卡,并在“管理”部分中双击“配置编辑器”。

  3. 单击 “分区 ”字段中的下拉箭头,导航到 system.webServer>安全性 ,然后选择“ requestFiltering”。

  4. In the results, expand requestLimits, and you'll see maxAllowedContentLength and the default value 30000000 (bytes).

若要更改 maxAllowedContentLength 值,请输入以字节为单位的新值,并单击" 应用"。 你需要更改客户端访问网站和后端网站上的值。

注意:可以在 IIS 管理器中更改相同的设置,网址为网站>默认网站>Microsoft-Server-ActiveSync站点>Exchange 后端>Microsoft-Server-ActiveSync,然后在“操作”区域中>的“编辑功能设置”中的“IIS”部分>更改请求筛选,“最大允许内容长度 (字节数”) 请求限制部分。

在 IIS 管理器中更改值后,新的 maxAllowedContentLength 键将写入表中所述的相应客户端访问或后端web.config文件。

Exchange Web 服务

服务 配置文件 键和默认值 Size
客户端访问(前端) %ExchangeInstallPath%FrontEnd\HttpProxy\ews\web.config maxAllowedContentLength="67108864" 字节
后端 %ExchangeInstallPath%ClientAccess\exchweb\ews\web.config maxAllowedContentLength="67108864" 字节
后端 %ExchangeInstallPath%ClientAccess\exchweb\ews\web.config http/https 绑定和身份验证方法的不同组合的 14 个 (实例 maxReceivedMessageSize="67108864") 字节

对 EWS 限制的说明

  • 在后端web.config文件中,UMLegacyMessageEncoderSoap11Element 绑定有两个不需要修改的值maxReceivedMessageSize="1048576"实例。

  • maxRequestLength 是这两个 web.config 文件中的 ASP.NET 设置,但不用于 EWS,因此你无需对其进行修改。

Outlook 网页版

服务 配置文件 键和默认值 Size
客户端访问(前端) %ExchangeInstallPath%FrontEnd\HttpProxy\owa\web.config maxAllowedContentLength="35000000" 字节
客户端访问(前端) %ExchangeInstallPath%FrontEnd\HttpProxy\owa\web.config maxRequestLength="35000" 千字节
后端 %ExchangeInstallPath%ClientAccess\Owa\web.config maxAllowedContentLength="35000000" 字节
后端 %ExchangeInstallPath%ClientAccess\Owa\web.config maxRequestLength="35000" 千字节
后端 %ExchangeInstallPath%ClientAccess\Owa\web.config http 和 https 绑定的 maxReceivedMessageSize="35000000" 2 个 (实例) 字节
后端 %ExchangeInstallPath%ClientAccess\Owa\web.config http 和 https 绑定的 maxStringContentLength="35000000" 2 个 (实例) 字节

对 Web 上的 Outlook限制的说明

  • 在后端web.config文件中,MsOnlineShellService 绑定有一个不需要修改的值maxStringContentLength="102400"实例。

开始前,有必要了解什么?

  • 估计完成时间:15 分钟

  • Exchange 权限不适用于本主题中的过程。 这些过程在 Exchange Server 的操作系统中执行。

  • 保存的 web.config 配置文件更改在重新启动 IIS 后应用。

  • 考虑到因 Base64 编码导致的 33% 的大小增长,请将所需的新最大大小值 (MB) 乘以 4/3。 要将该值转换成 KB,乘以 1024。 要将该值转换成字节,则乘以 1048756 (1024*1024)。 请注意,Base64 编码导致的大小增长可能会大于 33%,这取决于多种因素,例如,附件的大小、文件类型、压缩和电子邮件客户端。

  • 在 Exchange 服务器上的 Exchange XML 应用程序配置文件(例如,安装 Exchange CU 时,将 覆盖 web.config文件或EdgeTransport.exe.config文件) )中所做的任何自定义 Exchange 或 Internet 信息服务器 (IIS () 设置。 请务必保存此信息,以便在安装后轻松重新应用设置。 安装 Exchange CU 后,需要重新配置这些设置。

  • 若要了解本主题中的过程可能适用的键盘快捷键,请参阅 Exchange 管理中心内的键盘快捷键

提示

是否有任何疑问? 在 Exchange 论坛中寻求帮助。 请访问以下论坛:Exchange Server

使用记事本配置客户端特定的邮件大小限制

  1. 在记事本中打开相应的 web.config 文件。 例如,要打开 EWS 客户端的 web.config 文件,运行以下命令:

    Notepad %ExchangeInstallPath%ClientAccess\exchweb\ews\web.config
    
    Notepad %ExchangeInstallPath%FrontEnd\HttpProxy\ews\web.config
    
  2. 查找本主题前面的表格介绍的相应 web.config 文件中的相关注册表项。 例如,对于 EWS 客户端,请在客户端访问和后端web.config文件中查找 maxAllowedContentLength 键,并在后端web.config文件中查找值 maxReceivedMessageSize="67108864" 的所有 14 个实例。

    <requestLimits maxAllowedContentLength="67108864" />
    ...maxReceivedMessageSize="67108864"...
    

    例如,若要允许 Base64 编码的最大消息大小约为 64 MB,请将 的所有实例 67108864 更改为 89478486 (64*4/3*1048756) :

    <requestLimits maxAllowedContentLength="89478486" />
    ...maxReceivedMessageSize="89478486"...
    
  3. 完成后,保存并关闭web.config文件。

  4. 使用下列任一方法,在 Exchange Server 上重新启动 IIS:

    • 在 IIS 管理器中,选择服务器,然后单击" 操作"窗格中的" 重启"。

      在 IIS 管理器中,选择服务器,然后在“操作”窗格中单击“重启”。

    • 从提升的命令提示符运行以下命令, (打开的命令提示符窗口,方法是选择“ 以管理员身份运行 ”) :

      net stop w3svc /y
      
      net start w3svc
      

配置命令行中客户端特定的邮件大小限制

如果不使用记事本,还可以配置命令行中客户端特定的邮件大小限制。 打开 Exchange 服务器上提升的命令提示符(通过选择" 以管理员身份运行"打开一个命令提示符窗口)并为要配置的限制运行相应命令。

注意

  • 命令中的大小值为默认值,可能需要对其进行更改。

  • 请注意值的单位是字节还是千字节。

ActiveSync

%windir%\system32\inetsrv\appcmd.exe set config "Default Web Site/Microsoft-Server-ActiveSync/" -section:system.webServer/security/requestFiltering /requestLimits.maxAllowedContentLength:30000000
%windir%\system32\inetsrv\appcmd.exe set config "Default Web Site/Microsoft-Server-ActiveSync/" -section:system.web/httpRuntime /maxRequestLength:10240
%windir%\system32\inetsrv\appcmd.exe set config "Exchange Back End/Microsoft-Server-ActiveSync/" -section:system.webServer/security/requestFiltering /requestLimits.maxAllowedContentLength:30000000
%windir%\system32\inetsrv\appcmd.exe set config "Exchange Back End/Microsoft-Server-ActiveSync/" -section:system.web/httpRuntime /maxRequestLength:10240
%windir%\system32\inetsrv\appcmd.exe set config "Exchange Back End/Microsoft-Server-ActiveSync/" -section:appSettings /[key='MaxDocumentDataSize'].value:10240000

Exchange Web 服务

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

Outlook 网页版

%windir%\system32\inetsrv\appcmd.exe set config "Default Web Site/owa/" -section:system.webServer/security/requestFiltering /requestLimits.maxAllowedContentLength:35000000
%windir%\system32\inetsrv\appcmd.exe set config "Default Web Site/owa/" -section:system.web/httpRuntime /maxRequestLength:35000
%windir%\system32\inetsrv\appcmd.exe set config "Exchange Back End/owa/" -section:system.webServer/security/requestFiltering /requestLimits.maxAllowedContentLength:35000000
%windir%\system32\inetsrv\appcmd.exe set config "Exchange Back End/owa/" -section:system.web/httpRuntime /maxRequestLength:35000
%windir%\system32\inetsrv\appcmd.exe set config "Exchange Back End/owa/" -section:system.serviceModel/bindings /webHttpBinding.[name='httpsBinding'].maxReceivedMessageSize:35000000
%windir%\system32\inetsrv\appcmd.exe set config "Exchange Back End/owa/" -section:system.serviceModel/bindings /webHttpBinding.[name='httpBinding'].maxReceivedMessageSize:35000000
%windir%\system32\inetsrv\appcmd.exe set config "Exchange Back End/owa/" -section:system.serviceModel/bindings /webHttpBinding.[name='httpsBinding'].readerQuotas.maxStringContentLength:35000000
%windir%\system32\inetsrv\appcmd.exe set config "Exchange Back End/owa/" -section:system.serviceModel/bindings /webHttpBinding.[name='httpBinding'].readerQuotas.maxStringContentLength:35000000

如何知道操作成功?

若要验证是否已成功配置客户端特定的邮件大小限制,你需要使用受影响的客户端向/从某个邮箱发送和接收测试邮件。 可以尝试添加一些更小的附件或一个大的附件,以使测试邮件的大小比配置的值约小 33%。 例如,如果配置的值为 85 MB,则实际邮件的最大大小约为 64 MB。