大网数据广告活动
Web服务器与PHP

Fix IIS HTTP Error 404.13 (CONTENT_LENGTH_TOO_LARGE)

· 52CE 我爱测

Fix HTTP Error 404.13 in IIS when a request exceeds maxAllowedContentLength. Adjust the request size limit in web.config or ApplicationHost.config.

Original product version:   Internet Information Services 10.0 and later versions
Original KB number:   942074

Summary

This article helps you fix HTTP Error 404.13 - CONTENT_LENGTH_TOO_LARGE in Internet Information Services (IIS). You get this error when a request exceeds the maxAllowedContentLength limit in web.config or ApplicationHost.config.

Symptoms

Consider the following scenario. You have a web site that is hosted on a server that is running IIS 10.0 and later versions. When a user visits this web site, the user receives an error message that resembles the following error message:

Server Error in Application "<ApplicationName>"
HTTP Error 404.13 - CONTENT_LENGTH_TOO_LARGE
HRESULT: 0
Description of HRESULT # The operation completed successfully.

Cause

This problem occurs because the client request contains a Content-Length header that is larger than the value (in bytes) that is specified for the maxAllowedContentLength attribute in the ApplicationHost.config file or the site-level web.config file.

Solution

To resolve this problem, use one of the following methods.

Update the site-level web.config file (recommended)

Add or update the maxAllowedContentLength attribute in your site's web.config file. Set the value (in bytes) to match or exceed the size of the Content-Length header that the client sends. By default, the value of maxAllowedContentLength is 30000000 bytes (approximately 28.6 MB).

For example, to allow up to 50 MB, add the following inside the <system.webServer> section of your web.config file:

<system.webServer>
  <security>
    <requestFiltering>
      <requestLimits maxAllowedContentLength="52428800" />
    </requestFiltering>
  </security>
</system.webServer>

Edit the server-wide ApplicationHost.config file

  1. Select Start. In the Start Search box, type Notepad. Right-click Notepad, and then select Run as administrator.

    [!NOTE] If you are prompted for an administrator password or for a confirmation, type the password, or select Continue.

  2. On the File menu, select Open. In the File name box, type %windir%\system32\inetsrv\config\applicationhost.config, and then select Open.

  3. In the ApplicationHost.config file, locate the <requestLimits> node.

  4. Set the maxAllowedContentLength attribute to a value (in bytes) that matches or exceeds the size of the Content-Length header that the client sends as part of the request. By default, the value of maxAllowedContentLength is 30000000 bytes (approximately 28.6 MB). Alternatively, remove the attribute to revert to the default value.

    For example, modify the following configuration data inside the <requestFiltering> section:

    <requestLimits maxAllowedContentLength ="<ContentLengthInBytes>" />
    
  5. Save the ApplicationHost.config file.

Source: Microsoft Learn / IT Pro troubleshooting by Microsoft and contributors. Documentation licensed CC BY 4.0. Code samples are covered by the MIT License. Converted from Markdown, with links normalized and embedded media omitted.

资料来源与适用范围

资料来源
Microsoft Learn / IT Pro troubleshooting
适用范围
See source applicability · Source date 09/09/2026
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY 4.0 (documentation), MIT (code samples)

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。