配置客户端专属邮件大小限制Configure client-specific message size limits

在 Exchange Server 中,有几种不同的邮件大小限制,这些限制适用于邮件在您的组织中移动的情况。In Exchange Server, there are several different message size limits that apply to messages as they travel through your organization. 有关详细信息,请参阅Exchange Server 中的邮件大小限制For more information, see Message size limits in Exchange Server.

但是,你可以为使用 Exchange ActiveSync 或 Exchange Web 服务 (EWS) 的 Web 上的 Outlook(以前称为 Outlook Web App)和电子邮件客户端配置客户端特定的邮件大小限制。如果更改 Exchange 组织、连接器或用户邮件大小限制,则可能需要更改 Web 上的 Outlook、ActiveSync 和 EWS 的限制。下表介绍了这些限制。若要更改特定客户端类型的邮件大小限制,则需要更改此表中描述的 所有 值。However, there are client-specific message size limits you can configure for Outlook on the web (fornerly known as Outlook Web App) and email clients that use Exchange ActiveSync or Exchange Web Services (EWS). If you change the Exchange organizational, connector, or user message size limits, you likely need change the limits for Outlook on the web, ActiveSync, and EWS. These limits are described in the following tables. To change the message size limit for a specific client type, you need to change all the values that are described in the table.

备注

对于任何邮件大小限制,您设置的值都必须大于要强制应用的实际邮件大小。这样就可以对附件和其他二进制数据进行 Base64 编码了。由于 Base64 编码会导致邮件大小增加约 33%,因此您指定的值应比要强制应用的实际邮件大小高出约 33%。例如,如果您指定的最大邮件大小值为 64 MB,则可以预计实际最大邮件大小值约为 48 MB。For any message size limit, you need to set a value that's larger than the actual size you want enforced. This accounts for the Base64 encoding of attachments and other binary data. Base64 encoding increases the size of the message by approximately 33%, so the value you specify should be approximately 33% larger than the actual message size you want enforced. For example, if you specify a maximum message size value of 64 MB, you can expect a realistic maximum message size of approximately 48 MB.

ActiveSyncActiveSync

服务Services 配置文件Configuration file 键和默认值Keys and default values 大小Size
客户端访问(前端)Client Access (frontend) %ExchangeInstallPath%FrontEnd\HttpProxy\Sync\web.config maxAllowedContentLength="30000000"(默认情况下不存在; 请参阅注释)maxAllowedContentLength="30000000" (not present by default; see comments) 字节bytes
客户端访问(前端)Client Access (frontend) %ExchangeInstallPath%FrontEnd\HttpProxy\Sync\web.config maxRequestLength="10240" 千字节kilobytes
后端Backend %ExchangeInstallPath%ClientAccess\Sync\web.config maxAllowedContentLength="30000000 bytes"(默认情况下不存在; 请参阅注释)maxAllowedContentLength="30000000 bytes" (not present by default; see comments) 字节bytes
后端Backend %ExchangeInstallPath%ClientAccess\Sync\web.config maxRequestLength="10240" 千字节kilobytes
后端Backend %ExchangeInstallPath%ClientAccess\Sync\web.config <add key="MaxDocumentDataSize" value="10240000"> 字节bytes

对 ActiveSync 限制的说明Comments on ActiveSync limits

默认情况下,在 ActiveSync __ 的web.config文件中没有 maxAllowedContentLength 键。By default, there is no maxAllowedContentLength key in the web.config files for ActiveSync. 但是,ActiveSync 的最大邮件大小受应用于服务器上的所有网站的maxAllowedContentLength值的影响。However, the maximum message size for ActiveSync is affected by the maxAllowedContentLength value that is applied to all web sites on the server. 默认值为 30000000 字节。The default value is 30000000 bytes. 若要在 IIS Manager 中查看邮箱服务器上的 ActiveSync 的这些值,请执行以下步骤:To see these values for ActiveSync on Mailbox servers in IIS Manager, perform the following steps:

  1. 采取以下步骤之一:Do one of the following steps:

    • 对于客户端访问(前端)网站,打开" IIS 管理器",导航到" 网站">" 默认网站",并选择" Microsoft-Server-ActiveSync"。For the Client Access (frontend) web site, open IIS Manager, navigate to Sites > Default Web Site and select Microsoft-Server-ActiveSync.

    • 对于后端网站,打" IIS 管理器",导航到" 网站">" Exchange 后端",并选择" Microsoft-Server-ActiveSync"。For the backend web site, open IIS Manager, navigate to Sites > Exchange Back End and select Microsoft-Server-ActiveSync.

  2. 验证底部是否选择了 "功能视图" 选项卡,然后在 "管理" 部分双击 "配置编辑器"。Verify the Features View tab is selected at the bottom, and double-click Configuration Editor in the Management section.

  3. 单击" 部分"字段中的下拉箭头,导航到" system.webServer">" 安全",并选择" requestFiltering"。Click the drop down arrow in the Section field, navigate to system.webServer > security and select requestFiltering.

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

若要更改 maxAllowedContentLength 值,请输入以字节为单位的新值,并单击" 应用"。To change the maxAllowedContentLength value, enter a new value in bytes, and click Apply. 你需要更改客户端访问网站和后端网站上的值。You need to change the value on the Client Access web site and the back end web site.

注意:可以在站点 > **** >的 IIS 管理器中更改相同的设置。 microsoft-server-activesync站点 > Exchange 后端 > microsoft-服务器-activesync ,然后在iis >节中请求筛选在请求限制中允许的最大> "操作"内容长度(字节) 的 "编辑" 功能设置 **** 部分。Note: You can change the same setting in IIS manager at Sites > Default Web Site > Microsoft-Server-ActiveSync or Sites > Exchange Back End > Microsoft-Server-ActiveSync and then Request Filtering in the IIS section > Edit Feature Settings in the Actions area > Maximum allowed content length (Bytes) in the Request Limits section.

在 IIS 管理器中更改值之后,会将一个新的_maxAllowedContentLength_密钥写入到表中所述的相应客户端访问或后端 web.config 文件中。After you change the value in IIS Manager, a new maxAllowedContentLength key is written to the corresponding Client Access or backend web.config file that's described in the table.

Exchange Web 服务Exchange Web Services

服务Service 配置文件Configuration file 键和默认值Keys and default values 大小Size
客户端访问(前端)Client Access (frontend) %ExchangeInstallPath%FrontEnd\HttpProxy\ews\web.config maxAllowedContentLength="67108864" 字节bytes
后端Backend %ExchangeInstallPath%ClientAccess\exchweb\ews\web.config maxAllowedContentLength="67108864" 字节bytes
后端Backend %ExchangeInstallPath%ClientAccess\exchweb\ews\web.config 14个实例maxReceivedMessageSize="67108864" (用于不同的 http/https 绑定和身份验证方法的组合)14 instances of maxReceivedMessageSize="67108864" (for different combinations of http/https bindings and authentication methods) 字节bytes

对 EWS 限制的说明Comments on EWS limits

  • 在后端web.config文件中,不需要修改的UMLegacyMessageEncoderSoap11Element绑定maxReceivedMessageSize="1048576"的值有两个实例。In the backend web.config file, there are two instances of the value maxReceivedMessageSize="1048576" for UMLegacyMessageEncoderSoap11Element bindings that you don't need to modify.

  • maxRequestLength 是这两个 web.config 文件中的 ASP.NET 设置,但不用于 EWS,因此你无需对其进行修改。maxRequestLength is an ASP.NET setting that's present in both web.config files, but isn't used by EWS, so you don't need to modify it.

Outlook 网页版Outlook on the web

服务Service 配置文件Configuration file 键和默认值Keys and default values 大小Size
客户端访问(前端)Client Access (frontend) %ExchangeInstallPath%FrontEnd\HttpProxy\owa\web.config maxAllowedContentLength="35000000" 字节bytes
客户端访问(前端)Client Access (frontend) %ExchangeInstallPath%FrontEnd\HttpProxy\owa\web.config maxRequestLength="35000" 千字节kilobytes
后端Backend %ExchangeInstallPath%ClientAccess\Owa\web.config maxAllowedContentLength="35000000" 字节bytes
后端Backend %ExchangeInstallPath%ClientAccess\Owa\web.config maxRequestLength="35000" 千字节kilobytes
后端Backend %ExchangeInstallPath%ClientAccess\Owa\web.config 2个实例maxReceivedMessageSize="35000000" (用于 http 和 https 绑定)2 instances of maxReceivedMessageSize="35000000" (for http and https bindings) 字节bytes
后端Backend %ExchangeInstallPath%ClientAccess\Owa\web.config 2个实例maxStringContentLength="35000000" (用于 http 和 https 绑定)2 instances of maxStringContentLength="35000000" (for http and https bindings) 字节bytes

对 Web 上的 Outlook限制的说明Comments on Outlook on the web limits

  • 在后端web.config文件中,存在不需要修改的maxStringContentLength="102400" MsOnlineShellService绑定值的一个实例。In the backend web.config file, there's an instance of the value maxStringContentLength="102400" for the MsOnlineShellService binding that you don't need to modify.

在开始之前,您需要知道什么?What do you need to know before you begin?

  • 估计完成时间:15 分钟Estimated time to complete: 15 minutes

  • Exchange 权限不适用于本主题中的过程。这些过程在 Exchange Server 的操作系统中执行。Exchange permissions don't apply to the procedures in this topic. These procedures are performed in the operating system of the Exchange server.

  • 保存的 web.config 配置文件更改在重新启动 IIS 后应用。Changes you save to the web.config configuration file are applied after you restart IIS.

  • 考虑到因 Base64 编码导致的 33% 的大小增长,请将所需的新最大大小值 (MB) 乘以 4/3。要将该值转换成 KB,乘以 1024。要将该值转换成字节,则乘以 1048756 (1024*1024)。请注意,Base64 编码导致的大小增长可能会大于 33%,这取决于多种因素,例如,附件的大小、文件类型、压缩和电子邮件客户端。To allow for the 33% increase in size due to Base64 encoding, multiply your desired new maximum size value in megabytes by 4/3. To convert the value into kilobytes, multiply by 1024. To convert the value into bytes, multiply by 1048756 (1024*1024). Note that the size increase caused by Base64 encoding could be greater than 33%, and depends on several factors (for example, the attachment size, file type, compression, and the email client).

  • 在 Exchange 服务器上(例如,web.config 文件或 Edgetransport.exe 文件)上的 Exchange XML 应用程序配置文件中所做的任何自定义 Exchange 或 Internet 信息服务器(IIS)设置将在您安装 Exchange CU 时覆盖Any customized Exchange or Internet Information Server (IIS) settings that you made in Exchange XML application configuration files on the Exchange server (for example, web.config files or the EdgeTransport.exe.config file) will be overwritten when you install an Exchange CU. 请务必保存此信息,以便在安装后可以轻松地重新应用这些设置。Be sure save this information so you can easily re-apply the settings after the install. 安装 Exchange CU 后,需要重新配置这些设置。After you install the Exchange CU, you need to re-configure these settings.

  • 若要了解本主题中的过程可能适用的键盘快捷键,请参阅 Exchange 管理中心内的键盘快捷键For information about keyboard shortcuts that may apply to the procedures in this topic, see Keyboard shortcuts in the Exchange admin center.

提示

是否有任何疑问?Having problems? 在 Exchange 论坛中寻求帮助。Ask for help in the Exchange forums. 请访问以下论坛: Exchange ServerVisit the forums at: Exchange Server.

使用记事本配置客户端特定的邮件大小限制Use Notepad to configure a client-specific message size limit

  1. 在记事本中打开相应的 web.config 文件。例如,要打开 EWS 客户端的 web.config 文件,运行以下命令:Open the appropriate web.config files in Notepad. For example, to open the web.config files for EWS clients, run the following commands:

    Notepad %ExchangeInstallPath%ClientAccess\exchweb\ews\web.config
    
    Notepad %ExchangeInstallPath%FrontEnd\HttpProxy\ews\web.config
    
  2. 查找本主题前面的表格介绍的相应 web.config 文件中的相关注册表项。Find the relevant keys in the appropriate web.config files as described in the tables earlier in the topic. 例如,对于 EWS 客户端,请在客户端访问和后端 web.config 文件中查找_maxAllowedContentLength_项,并在后端 web.config 文件maxReceivedMessageSize="67108864"中查找值的所有14个实例。For example, for EWS clients, find the maxAllowedContentLength key in the Client Access and backend web.config files and all 14 instances of the value maxReceivedMessageSize="67108864" in the backend web.config file.

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

    例如,若要允许 Base64 编码的最大邮件大小约为 64 MB,请将的67108864所有89478486实例更改*为*(64 4/3 1048756):For example, to allow a Base64 encoded maximum message size of approximately 64 MB, change all instances of 67108864 to 89478486 (64*4/3*1048756):

    <requestLimits maxAllowedContentLength="89478486" />
    ...maxReceivedMessageSize="89478486"...
    
  3. 完成后,保存并关闭 web.config 文件。When you're finished, save and close the web.config files.

  4. 使用下列任一方法,在 Exchange Server 上重新启动 IIS:Restart IIS on the Exchange server by using either of the following methods:

    • 在 IIS 管理器中,选择服务器,然后单击" 操作"窗格中的" 重启"。Open IIS Manager, select the server, and in the Actions pane, click Restart.

      在 IIS Manager 中,选择服务器,然后单击'操作'窗格中的'重启'

    • 从提升的命令提示符(通过选择 "以管理员身份运行" 打开的命令提示符窗口)中运行以下命令:Run the following commands from an elevated command prompt (a Command Prompt window you open by selecting Run as administrator):

      net stop was /y
      
      net start w3svc
      

配置命令行中客户端特定的邮件大小限制Configure client-specific message size limits from the command line

如果不使用记事本,还可以配置命令行中客户端特定的邮件大小限制。打开 Exchange 服务器上提升的命令提示符(通过选择" 以管理员身份运行"打开一个命令提示符窗口)并为要配置的限制运行相应命令。Instead of using Notepad, you can also configure the client-specific message size limits from the command line. Open an elevated command prompt on the Exchange server (a Command Prompt window you open by selecting Run as administrator) and run the appropriate commands for the limits that you want to configure.

注意Notes:

  • 命令中的大小值为默认值,可能需要对其进行更改。The size values in the commands are the default values, so you'll need to change them.

  • 请注意值的单位是字节还是千字节。Pay attention to whether the value is in bytes or kilobytes.

ActiveSyncActiveSync

%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 服务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 网页版Outlook on the web

%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

如何判断是否生效?How do you know this worked?

若要验证是否已成功配置客户端特定的邮件大小限制,你需要使用受影响的客户端向/从某个邮箱发送和接收测试邮件。可以尝试添加一些更小的附件或一个大的附件,以使测试邮件的大小比配置的值约小 33%。例如,如果配置的值为 85 MB,则实际邮件的最大大小约为 64 MB。To verify that you have successfully configured the client-specific message size limit, you need to send a test message to and from a mailbox by using the affected client. You can try a few smaller attachments or one large attachment so the test messages are approximately 33% less than the value you configured. For example, a configured value of 85 MB results in a realistic maximum message size of approximately 64 MB.