本文介绍了从commadline设置UrlSegmentMaxLength的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以使用appcmd/netsh或任何其他命令行实用程序为Http.sys
设置UrlSegmentMaxLength
值?
Is there a way to set the UrlSegmentMaxLength
value for Http.sys
using appcmd/netsh or any other commandline utility?
推荐答案
我意识到这是一个老问题,但是如果有人偶然发现了这个问题,那么这里的PowerShell One-liner可以创建密钥,设置值或更新现有的值.
I realize this is an old question, but in case someone stumbles upon this, here's PowerShell one-liner that either creates the key and sets the value or updates existing value.
if ((Get-ItemProperty -Path HKLM:\System\CurrentControlSet\Services\HTTP\Parameters -Name UrlSegmentMaxLength -ErrorAction SilentlyContinue) -eq $null) { New-ItemProperty -Path HKLM:\System\CurrentControlSet\Services\HTTP\Parameters -Name UrlSegmentMaxLength -Value 2048 -PropertyType DWord } else { Set-ItemProperty -Path HKLM:\System\CurrentControlSet\Services\HTTP\Parameters -Name UrlSegmentMaxLength -Value 2048 }
`
关于重新启动,我发现这很好(不需要重新启动服务器):
As for restarting, I found that this works well (no need to restart the server):
Stop-Service http -Force
Start-Service http
Start-Service IISADMIN
Start-Service W3SVC
这篇关于从commadline设置UrlSegmentMaxLength的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!