0

我在Windows服務器2012 R2上安裝了IIS 8.5。我正在嘗試從我的響應中刪除服務器:Microsoft-IIS/8.5標頭。刪除服務器:來自響應頭的Microsoft-IIS/8.5標頭

我試圖安裝URLScan的,但它失敗,出現以下錯誤

IIS Metabase is required to install Microsoft URLScan Filter v3.1. 

我試圖從我的網站上UrlRewrite設置中刪除它來安裝,但它不工作。任何人都可以請幫忙。

回答

1

我使用自定義模塊清潔程序在我的頭:

public class HeadersCleanupModule : IHttpModule 
{ 
    public void Init(HttpApplication context) 
    { 
     context.PostReleaseRequestState += application_PostReleaseRequestState; 
    } 


    void application_PostReleaseRequestState(object sender, EventArgs e) 
    { 
     HttpContext.Current.Response.Headers.Remove("Server"); 
     HttpContext.Current.Response.Headers.Remove("X-AspNet-Version"); 
     HttpContext.Current.Response.Headers.Remove("ETag"); 
    } 


} 
+0

你把它在Global.asax中? – progrAmmar

+0

我把它放在我的web項目的根目錄下,並登記在Web.config中的模塊: ' <添加名稱= 「HeadersCleanupModule」 TYPE = 「WebApp.HeadersCleanupModule」/> ' –

+1

好的非常感謝 – progrAmmar