Netsh http 命令

Use netsh http to query and configure HTTP.sys settings and parameters.

Tip

If you are using Windows PowerShell on a computer running Windows Server or Windows 10, type netsh and press Enter. At the netsh prompt, type http and press Enter to get the netsh http prompt.

       netsh http>

可用的 netsh http 命令包括:

add iplisten

向 IP 侦听列表添加新的 IP 地址(不包括端口号)。

Syntax

add iplisten [ ipaddress= ] IPAddress

Parameters

Parameter Description Requirement
ipaddress 要添加到 IP 侦听列表的 IPv4 或 IPv6 地址。 IP 侦听列表用于确定 HTTP 服务绑定到的地址列表的范围。 “0.0.0.0”表示任何 IPv4 地址,“::”表示任何 IPv6 地址。 Required

Examples

Following are four examples of the add iplisten command.

  • add iplisten ipaddress=fe80::1
  • add iplisten ipaddress=1.1.1.1
  • add iplisten ipaddress=0.0.0.0
  • add iplisten ipaddress=::

add sslcert

为 IP 地址和端口添加新的 SSL 服务器证书绑定和相应的客户端证书策略。

Syntax

add sslcert [ ipport= ] IPAddress:port [ certhash= ] CertHash [ appid= ] GUID [ [ certstorename= ] CertStoreName [ verifyclientcertrevocation= ] enable | disable [verifyrevocationwithcachedclientcertonly= ] enable | disable [ usagecheck= ] enable | disable [ revocationfreshnesstime= ] U-Int [ urlretrievaltimeout= ] U-Int [sslctlidentifier= ] SSLCTIdentifier [ sslctlstorename= ] SLCtStoreName [ dsmapperusage= ] enable | disable [ clientcertnegotiation= ] enable | disable ] ]

Parameters

Parameter Description Requirement
ipport 指定绑定的 IP 地址和端口。 冒号字符 (:) 用作 IP 地址和端口号之间的分隔符。 Required
certhash 指定证书的 SHA 哈希。 此哈希长度为 20 个字节,并指定为十六进制字符串。 Required
appid 指定用于标识所属应用程序的 GUID。 Required
certstorename 指定证书的存储名称。 默认情况下为 MY。 证书必须存储在本地计算机上下文中。 Optional
verifyclientcertrevocation 指定客户端证书吊销的打开/关闭验证。 Optional
verifyrevocationwithcachedclientcertonly 指定是启用还是禁用仅将缓存的客户端证书用于吊销检查。 Optional
usagecheck 指定是启用或禁用使用情况检查。 默认为启用。 Optional
revocationfreshnesstime 指定检查更新的证书吊销列表 (CRL) 的时间间隔(以秒为单位)。 如果此值为零,则仅当上一个 CRL 过期时才会更新新的 CRL。 Optional
urlretrievaltimeout 指定尝试检索远程 URL 的证书吊销列表后的超时间隔(以毫秒为单位)。 Optional
sslctlidentifier 指定可信任的证书颁发者的列表。 此列表可以是计算机信任的证书颁发者的子集。 Optional
sslctlstorename 指定存储 SslCtlIdentifier 的 LOCAL_MACHINE 下的证书存储名称。 Optional
dsmapperusage 指定是启用还是禁用 DS 映射器。 默认为禁用。 Optional
clientcertnegotiation 指定是启用还是禁用证书协商。 默认为禁用。 Optional

Examples

Following is an example of the add sslcert command.

add sslcert ipport=1.1.1.1:443 certhash=0102030405060708090A0B0C0D0E0F1011121314 appid={00112233-4455-6677-8899-AABBCCDDEEFF}


add timeout

将全局超时添加到服务。

Syntax

add timeout [ timeouttype= ] IdleConnectionTimeout | HeaderWaitTimeout [ value=] U-Short

Parameters

Parameter Description
timeouttype 设置的超时类型。
value 超时值(以秒为单位)。 如果该值采用十六进制表示法,则添加前缀 0x。

Examples

Following are two examples of the add timeout command.

  • add timeout timeouttype=idleconnectiontimeout value=120
  • add timeout timeouttype=headerwaittimeout value=0x40

add urlacl

添加统一资源定位器 (URL) 保留条目。 此命令保留非管理员用户和帐户的 URL。 可以通过将 NT 帐户名与侦听和委托参数一起使用或使用 SDDL 字符串来指定 DACL。

Syntax

add urlacl [ url= ] URL [ [user=] User [ [ listen= ] yes | no [ delegate= ] yes | no ] | [ sddl= ] SDDL ]

Parameters

Parameter Description Requirement
url 指定完全限定的统一资源定位器 (URL)。 Required
user 指定用户或用户组名称 Required
listen 指定以下值之一:yes:允许用户注册 URL。 这是默认值。 no:拒绝用户注册 URL。 Optional
delegate 指定以下值之一: yes:允许用户委托 URL no:拒绝用户委托 URL。 这是默认值。 Optional
sddl 指定描述 DACL 的 SDDL 字符串。 Optional

Examples

Following are four examples of the add urlacl command.


delete cache

从 HTTP 服务内核 URI 缓存中删除所有条目或指定的条目。

Syntax

delete cache [ [ url= ] URL [ [recursive= ] yes | no ]

Parameters

Parameter Description Requirement
url 指定要删除的完全限定的统一资源定位器 (URL)。 Optional
recursive 指定是否删除 URL 缓存下的所有条目。 yes: remove all entries no: do not remove all entries Optional

Examples

Following are two examples of the delete cache command.


delete iplisten

从 IP 侦听列表中删除 IP 地址。 IP 侦听列表用于确定 HTTP 服务绑定到的地址列表的范围。

Syntax

delete iplisten [ ipaddress= ] IPAddress

Parameters

Parameter Description Requirement
ipaddress 要从 IP 侦听列表删除的 IPv4 或 IPv6 地址。 IP 侦听列表用于确定 HTTP 服务绑定到的地址列表的范围。 “0.0.0.0”表示任何 IPv4 地址,“::”表示任何 IPv6 地址。 这不包括端口号。 Required

Examples

Following are four examples of the delete iplisten command.

  • delete iplisten ipaddress=fe80::1
  • delete iplisten ipaddress=1.1.1.1
  • delete iplisten ipaddress=0.0.0.0
  • delete iplisten ipaddress=::

delete sslcert

删除 IP 地址和端口的 SSL 服务器证书绑定和相应的客户端证书策略。

Syntax

delete sslcert [ ipport= ] IPAddress:port

Parameters

Parameter Description Requirement
ipport 指定要为其删除 SSL 证书绑定的 IPv4 或 IPv6 地址和端口。 冒号字符 (:) 用作 IP 地址和端口号之间的分隔符。 Required

Examples

Following are three examples of the delete sslcert command.

  • delete sslcert ipport=1.1.1.1:443
  • delete sslcert ipport=0.0.0.0:443
  • delete sslcert ipport=[::]:443

delete timeout

删除全局超时,并将服务恢复为默认值。

Syntax

delete timeout [ timeouttype= ] idleconnectiontimeout | headerwaittimeout

Parameters

Parameter Description Requirement
timeouttype 指定超时设置的类型。 Required

Examples

Following are two examples of the delete timeout command.

  • delete timeout timeouttype=idleconnectiontimeout
  • delete timeout timeouttype=headerwaittimeout

delete urlacl

删除 URL 保留项。

Syntax

delete urlacl [ url= ] URL

Parameters

Parameter Description Requirement
url 指定要删除的完全限定的统一资源定位器 (URL)。 Required

Examples

Following are two examples of the delete urlacl command.


flush logbuffer

刷新日志文件的内部缓冲区。

Syntax

flush logbuffer

show cachestate

列出缓存的 URI 资源及其相关属性。 此命令列出缓存在 HTTP 响应缓存中的所有资源和相关属性,或显示单个资源及其相关属性。

Syntax

show cachestate [ [url= ] URL]

Parameters

Parameter Description Requirement
url 指定要显示的完全限定的 URL。 如果未指定,则显示所有 URL。 该 URL 还可以是注册 URL 的前缀。 Optional

Examples

Following are two examples of the show cachestate command:


show iplisten

在 IP 侦听列表中显示所有 IP 地址。 IP 侦听列表用于确定 HTTP 服务绑定到的地址列表的范围。 “0.0.0.0”表示任何 IPv4 地址,“::”表示任何 IPv6 地址。

Syntax

show iplisten

show servicestate

显示 HTTP 服务的屏幕截图。

Syntax

show servicestate [ [ view= ] session | requestq ] [ [ verbose= ] yes | no ]

Parameters

Parameter Description Requirement
View 指定是否基于服务器会话或请求队列查看 HTTP 服务状态的快照。 Optional
Verbose 指定是否显示还显示属性信息的详细信息。 Optional

Examples

Following are two examples of the show servicestate command.

  • show servicestate view=“session”
  • show servicestate view="requestq"

show sslcert

显示 IP 地址和端口的安全套接字层 (SSL) 服务器证书绑定和相应的客户端证书策略。

Syntax

show sslcert [ ipport= ] IPAddress:port

Parameters

Parameter Description Requirement
ipport 指定 SSL 证书绑定显示的 IPv4 或 IPv6 地址和端口。 冒号字符 (:) 用作 IP 地址和端口号之间的分隔符。 如果未指定 ipport,则会显示所有绑定。 Required

Examples

Following are five examples of the show sslcert command.

  • show sslcert ipport=[fe80::1]:443
  • show sslcert ipport=1.1.1.1:443
  • show sslcert ipport=0.0.0.0:443
  • show sslcert ipport=[::]:443
  • show sslcert

show timeout

显示 HTTP 服务的超时值(以秒为单位)。

Syntax

show timeout

show urlacl

显示指定保留 URL 或所有保留 URL 的自由访问控制列表 (DACL)。

Syntax

show urlacl [ [url= ] URL]

Parameters

Parameter Description Requirement
url 指定要显示的完全限定的 URL。 如果未指定,则显示所有 URL。 Optional

Examples

Following are three examples of the show urlacl command.