RequestLimitsElement 类

指定传入 HTTP 请求的大小限制。

语法

class RequestLimitsElement : EmbeddedObject  

方法

此类不包含任何方法。

属性

下表列出了 RequestLimitsElement 类公开的属性。

名称 描述
HeaderLimits 一个 HeaderLimitsSettings 值,该值指定 HTTP 头大小。
MaxAllowedContentLength 一个读/写 uint32 值,该值指定请求中内容的最大长度(以字节为单位)。 默认值为 30000000(约 30 MB)。
MaxQueryString 一个读/写 uint32 值,该值指定查询字符串的最大长度(以字节为单位)。 默认值为 2048。
MaxUrl 一个读/写 uint32 值,该值指定请求 URL 的最大长度(以字节为单位)。 默认值为 260。

子类

此类不包含子类。

注解

此类的实例包含在 RequestFilteringSection 类的 RequestLimits 数组属性中。

此类将旧版 IIS 使用的 URLScan 工具的 RequestLimits 设置集成到 IIS 7 中。

注意

必须安装请求筛选模块 (Modrqflt.dll) 才能使此类中的设置生效。

示例

以下示例显示 RequestLimitsElement 类的所有属性。

' Connect to the WMI WebAdministration namespace.  
Set objWMIService = GetObject("winmgmts:root\WebAdministration")  
  
' Get the RequestFilteringSection.  
Set oRequestFilteringSection = objWMIService.Get( _  
"RequestFilteringSection.Path='MACHINE/WEBROOT/APPHOST',Location=''")  
  
' Set a variable to the RequestFilteringSection.RequestLimits property,  
' which contains an array of RequestLimitsElement objects.  
Set oRequestLimitsElement = oRequestFilteringSection.RequestLimits  
  
' Display the path and list the non-array RequestLimitsElement properties.  
WScript.Echo "[Request Limits]"  
WScript.Echo "Path: " & oRequestFilteringSection.Path   
WScript.Echo "maxAllowedContentLength: " & _  
    oRequestLimitsElement.maxAllowedContentLength  
WScript.Echo "maxUrl: " & oRequestLimitsElement.maxUrl  
WScript.Echo "maxQueryString: " & oRequestLimitsElement.maxQueryString  
WScript.Echo   
  
' List the contents of the RequestLimitsElement.HeaderLimits.HeaderLimits  
' property, which contains an array of HeaderLimitsElement instances.  
WScript.Echo vbtab & "[Header Limits]"  
For Each oHeaderLimit In oRequestLimitsElement.HeaderLimits.HeaderLimits  
    WScript.Echo vbtab & "Header: " & oHeaderLimit.Header  
    WScript.Echo vbtab & "Header size limit: " & oHeaderLimit.sizeLimit  
    WScript.Echo   
Next  

继承层次结构

EmbeddedObject

RequestLimitsElement

要求

类型 描述
客户端 - IIS 7.0(在 Windows Vista 上)
- IIS 7.5(在 Windows 7 上)
- IIS 8.0(在 Windows 8 上)
- IIS 10.0(在 Windows 10 上)
服务器 - IIS 7.0(在 Windows Server 2008 上)
- IIS 7.5(在 Windows Server 2008 R2 上)
- IIS 8.0(在 Windows Server 2012 上)
- IIS 8.5(在 Windows Server 2012 R2 上)
- IIS 10.0(在 Windows Server 2016 上)
产品 - IIS 7.0、IIS 7.5、IIS 8.0、IIS 8.5、IIS 10.0
MOF 文件 WebAdministration.mof

另请参阅

EmbeddedObject 类
FileExtensionsSettings 类
HeaderLimitsElement 类
HeaderLimitsSettings 类
RequestFilteringSection 类
<requestLimits>
VerbsSettings 类