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

Response filtering and post-cache substitution not compatible

· 52CE 我爱测

This article describes a fact that ASP.NET response filter module and post-cache substitution aren't compatible.

This article helps you resolve the problem that are caused when you use response filtering and post-cache substitution at the same time.

Original product version:   Internet Information Services 7.0 and later versions
Original KB number:   2014472

Symptoms

Consider the following scenario:

  1. You have an ASP.NET application running on IIS 7.0 or a later version.
  2. The application uses post-cache substitution.
  3. The application also uses an Hypertext Transfer Protocol (HTTP) filter module to filter out rendered content.

In this scenario, one of the following problems may occur:

  • If the application is hosted on IIS7 in Classic Pipeline mode, the substitution blocks are only rendered on the first request. Subsequent page accesses cause the full page to be served from the output cache and the substitution blocks to not be updated.

  • If the application is hosted on IIS7 in Integrated Pipeline mode, an exception of type System.InvalidOperationException occurs with the following details:

    Exception Details: System.InvalidOperationException: Post cache substitution is not compatible with modules in the IIS integrated pipeline that modify the response buffers. Either a native module in the pipeline has modified an HTTP_DATA_CHUNK structure associated with a managed post cache substitution callback, or a managed filter has modified the response.

Cause

Response filtering and post-cache substitution aren't compatible.

Resolution

To avoid the problem,use one of the following options:

  • Disable output caching on pages that are using substitution blocks.
  • Don't use the response filter module.

More information

Post-cache substitution is implemented using a list of substitution blocks (.NET delegates) used to reconstruct individual pieces of the response. ASP.NET internally maintains a list of HTTP_DATA_CHUNK structures associated with a managed post-cache substitution callback. When a response filter is used, a raw response is rendered into a single buffer and the list of substitution blocks is lost. Therefore, the substitution blocks can't be rendered. For more information on post-cache substitution, see Caching Portions of an ASP.NET Page.

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 04/16/2020
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY 4.0 (documentation), MIT (code samples)

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

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