HttpRuntimeSection.EnableKernelOutputCache 属性

定义

获取或设置一个值,该值指示是否启用输出缓存。

public:
 property bool EnableKernelOutputCache { bool get(); void set(bool value); };
[System.Configuration.ConfigurationProperty("enableKernelOutputCache", DefaultValue=true)]
public bool EnableKernelOutputCache { get; set; }
[<System.Configuration.ConfigurationProperty("enableKernelOutputCache", DefaultValue=true)>]
member this.EnableKernelOutputCache : bool with get, set
Public Property EnableKernelOutputCache As Boolean

属性值

true 如果启用了输出缓存,则为 ;否则,为 false. 默认值为 true

属性

示例

以下示例演示如何使用该 EnableKernelOutputCache 属性。

// Get the current EnableKernelOutputCache property value.
Response.Write("EnableKernelOutputCache: " +
  configSection.EnableKernelOutputCache + "<br>");

// Set the EnableKernelOutputCache property to true.
configSection.EnableKernelOutputCache = true;
' Get the current EnableKernelOutputCache property value.
Response.Write("EnableKernelOutputCache: " & _
  configSection.EnableKernelOutputCache & "<br>")

' Set the EnableKernelOutputCache property to true.
configSection.EnableKernelOutputCache = True

注解

若要缓存响应,需要满足以下条件:

  • 缓存必须由页面指令或缓存 API 显式启用。

  • 缓存必须具有过期策略,以便内核知道何时放弃它。

  • 缓存不能有任何变量标头或参数。

  • 请求不得要求任何身份验证。

注释

仅当安装了 Internet Information Services 6.0 或更高版本时,此属性才相关。

适用于

另请参阅