WorkerProcess.GetExecutingRequests 方法 2

获取当前分配给工作进程的请求。

语法

objWorkerProcess.GetExecutingRequests(RequestArray);  
objWorkerProcess.GetExecutingRequests RequestArray  

参数设置

名称 定义
RequestArray 用于保存 HttpRequest 对象的数组。

返回值

此方法不返回值。

注解

此方法采用空数组作为 OUT 参数,该参数用 HttpRequest 对象填充。

示例

以下示例获取有关每个工作进程当前排队的请求的信息。

' Connect to the WMI WebAdministration namespace.  
Set oWebAdmin = GetObject("winmgmts:root\WebAdministration")  
  
' Get the worker processes.  
Set oW3WPs = oWebAdmin.InstancesOf("WorkerProcess")  
  
For Each oW3WP In oW3WPs  
  
    ' Place the requests queued for a process into an array.  
    oW3WP.GetExecutingRequests arrReqs  
  
    ' Show the number of queued requests.  
    If IsNull(arrReqs) Then  
        WScript.Echo "No currently executing requests."  
    Else  
        ' Display the number of requests.  
        WScript.Echo "Number of currently executing requests: " & _  
            UBound(arrReqs) + 1  
        WScript.Echo  
  
        ' List the properties of each request.  
        For Each oRequest In arrReqs  
            WScript.Echo "Module: " & "[" & oRequest.CurrentModule & "]"  
            WScript.Echo "Verb:" & "[" & oRequest.Verb & "]"  
            WScript.Echo "HostName: " & "[" & oRequest.HostName & "]"  
            WScript.Echo "Url: " & "[" & oRequest.Url & "]"  
            WScript.Echo  
        Next  
    End If  
Next  

要求

类型 描述
客户端 - 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

另请参阅

HttpRequest 类
查看工作进程中当前正在执行的请求
WorkerProcess 类