移除Serverapp
藉助IIS URL Rewrite Module,添加以下的重寫規則:this
<rewrite>
<allowedServerVariables>
<add name="REMOTE_ADDR" />
</allowedServerVariables>
<outboundRules>
<rule name="REMOVE_RESPONSE_SERVER">
<match serverVariable="RESPONSE_SERVER" pattern=".*" />
<action type="Rewrite" />
</rule>
</outboundRules>
</rewrite>
重寫規則存放在C:\Windows\System32\inetsrv\config\applicationHost.config中。
Add this to your global.asax.cs:spa
protected void Application_PreSendRequestHeaders() { Response.Headers.Remove("Server"); Response.Headers.Remove("X-AspNet-Version"); Response.Headers.Remove("X-AspNetMvc-Version"); }