配置客户端专属邮件大小限制

适用于:Exchange Server 2013

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

但是,可以为使用 ActiveSync 或 Exchange Web Services (EWS) 的Outlook Web App和电子邮件客户端配置特定于客户端的邮件大小限制。 如果更改 Exchange 组织范围的邮件大小限制,则需要验证是否相应地设置了Outlook Web App、ActiveSync 和 Exchange Web 服务的邮件大小限制。 可以在客户端访问服务器和邮箱服务器上的 web.config 文件中配置这些值。 下表介绍了这些限制。

Exchange ActiveSync

服务器角色 配置文件 键和默认值 Size
客户端访问 %ExchangeInstallPath%FrontEnd\HttpProxy\Sync\web.config maxAllowedContentLength="30000000 bytes"

默认情况下不存在(请参阅注释)。
字节
客户端访问 %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 的文件中没有 maxAllowedContentLengthweb.config 。 但是,ActiveSync 的最大消息大小受应用于服务器上所有网站的 maxAllowedContentLength 值的影响。 默认值为 30000000 字节 (30 MB) 。 若要在 IIS 管理器中查看客户端访问服务器和邮箱服务器上的 ActiveSync 的这些值,请执行以下步骤:

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

    • 在客户端访问服务器上,打开 IIS 管理器,导航到 “站点>”“默认网站 ”,然后选择“ Microsoft-Server-ActiveSync”。
    • 在邮箱服务器上,打开 IIS 管理器,导航到 站点>Exchange 后端 ,然后选择 Microsoft-Server-ActiveSync
  2. Verify Features View is selected, and double-click Configuration Editor in the Management section.

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

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

若要更改 maxAllowedContentLength 值,请输入以字节为单位的新值,并单击" 应用"。 需要更改客户端访问服务器和邮箱服务器上的值。 在 IIS 管理器中更改值后,新的 maxAllowedContentLength 密钥将写入客户端访问服务器上的相应 web.config 文件 (%ExchangeInstallPath%FrontEnd\HttpProxy\Sync\web.config ,并在 %ExchangeInstallPath%ClientAccess\Sync\web.config 邮箱服务器上) 。

若要更改 ActiveSync 客户端的最大邮件大小,需要更改客户端访问服务器和邮箱服务器上的文件中 maxRequestLengthweb.config 的值,更改邮箱服务器上的文件中 的 MaxDocumentDataSizeweb.config 值,在客户端访问服务器和邮箱服务器上的 IIS 管理器中 更改 maxAllowedContentLength 的值。

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 的 14 个实例 maxReceivedMessageSize="67108864" 字节

有关 Exchange Web Services 限制的注释

  • maxReceivedMessageSize="67108864" 有 14 个单独的实例,这些实例对应于 http 和 https) 和身份验证方法 (绑定的不同组合。

  • 若要更改 Exchange Web Services 客户端的最大邮件大小,需要更改两个web.config文件中 maxAllowedContentLength 的值,并在邮箱服务器上更改文件中的所有 14 个maxReceivedMessageSize="67108864"web.config实例。

  • web.config在邮箱服务器上的文件中,还有两个不需要修改的 UMLegacyMessageEncoderSoap11Element 绑定的值maxReceivedMessageSize="1048576"实例。

  • maxRequestLength 是两个 web.config 文件中都存在的 ASP.NET 设置,但 Exchange Web 服务不使用,因此无需修改它。

Outlook Web App

服务器角色 配置文件 键和默认值 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 的 2 个实例 maxReceivedMessageSize="35000000" 字节
邮箱 %ExchangeInstallPath%ClientAccess\Owa\web.config 的 2 个实例 maxStringContentLength="35000000" 字节

有关Outlook Web App限制的注释

  • web.config在邮箱服务器上的文件中,有两个单独的值maxReceivedMessageSize="35000000"实例,maxStringContentLength="35000000"它们对应于 http 和 https 绑定。

  • 若要更改 Outlook Web App 客户端的最大邮件大小,需要更改这两个文件中的所有这些值,包括邮箱服务器上文件中 maxReceivedMessageSizemaxStringContentLengthweb.config 的两个实例。

  • web.config在邮箱服务器上的文件中,还有一个 MsOnlineShellService 绑定值maxStringContentLength="102400"实例,无需修改。

对于所有消息大小限制,需要设置大于要强制实施的实际大小的值。 这种值增加对于在邮件附件和任何其他二进制数据进行 Base64 编码后不可避免的邮件大小增加是必要的。 Base64 编码使消息的大小增加约 33%,因此你为任何消息大小限制指定的值大约比实际可用消息大小大 33%。 例如,如果将最大消息大小值指定为 64 MB,则可以预期实际的最大消息大小值大约为 48 MB。

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

  • 估计完成时间:15 分钟

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

  • 在重启 IIS 后,将应用保存到 Web.config 配置文件的更改。

  • 若要允许由于 Base64 编码而导致大小增加 33%,请将所需的新最大大小值(以兆字节为单位)乘以 4/3。 要将该值转换成 KB,乘以 1024。 若要将值转换为字节,请将1048576 (乘以 1024*1024) 。 请注意,Base64 编码导致的大小增加可能大于 33%,具体取决于多个因素,例如附件文件大小、类型、压缩以及用于撰写和发送邮件的电子邮件客户端。

  • 在您安装 Exchange 累积更新 (CU) 时,您在 Exchange XML 应用程序配置文件(例如,客户端访问服务器上的 web.config 文件,或邮箱服务器上的 EdgeTransport.exe.config 文件)中针对每个服务器所做的任何自定义设置都将被覆盖。 请务必保存此类信息,以便在安装累积更新后,您可以轻松地重新配置服务器。 安装 Exchange CU 后,您必须重新配置这些设置。

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

提示

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

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

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

    Notepad %ExchangeInstallPath%ClientAccess\exchweb\ews\web.config
    Notepad %ExchangeInstallPath%FrontEnd\HttpProxy\ews\web.config
    
  2. 查找本主题前面的表格介绍的相应 web.config 文件中的相关注册表项。 例如,对于 Exchange Web Services 客户端,请在两个文件中查找 maxAllowedContentLength 键,并在邮箱服务器上的文件中查找值maxReceivedMessageSize="67108864"web.config的所有 14 个实例。

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

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

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

  4. 通过运行以下命令来重新启动 IIS:

    IISReset /noforce
    

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

如果不使用记事本,还可以配置命令行中客户端特定的邮件大小限制。 打开 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 Services 邮件大小限制

%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 Web App消息大小限制

%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。