如果不考虑使用第三方控件实现,可以用PowerShell的方式:
Set-WebConfigurationProperty -pspath 'MACHINE/WEBROOT/APPHOST' -filter "system.webServer/security/requestFiltering" -name "removeServerHeader" -value "True"
大概是修改IIS的配置:
C:\Windows\System32\inetsrv\config\applicationHost.config
<system.webServer>
<security>
<requestFiltering removeServerHeader="true">
//...
<requestFiltering>
<security>
<system.webServer>
参考:
EOF
Power by TeXt.