IIS下删除响应Header里面的Server Header

如果不考虑使用第三方控件实现,可以用PowerShell的方式:

Set-WebConfigurationProperty -pspath 'MACHINE/WEBROOT/APPHOST' -filter "system.webServer/security/requestFiltering" -name "removeServerHeader" -value "True"

大概是修改IIS的配置:

C:WindowsSystem32inetsrvconfigapplicationHost.config

<system.webServer>
  <security>
     <requestFiltering removeServerHeader="true">
      //...
           <requestFiltering>
      <security>
<system.webServer>

  

原文地址:https://www.cnblogs.com/wybin6412/p/12924938.html