فهرست منبع

Remove unnecessary HTTP response headers

This removes:

X-AspNetMvc-Version: 4.0
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET

I didn't see any performance improvement, but this is probably a good idea
in case the extra bytes cause another network packet to be needed,
compared to other frameworks.
Malcolm Evershed 12 سال پیش
والد
کامیت
6a6437588a
3فایلهای تغییر یافته به همراه7 افزوده شده و 0 حذف شده
  1. 2 0
      aspnet/src/Application.cs
  2. 2 0
      aspnet/src/Web.config
  3. 3 0
      installer.ps1

+ 2 - 0
aspnet/src/Application.cs

@@ -23,6 +23,8 @@ namespace Benchmarks.AspNet
 
         private void Start()
         {
+            // Remove X-AspNetMvc-Version HTTP response header
+            MvcHandler.DisableMvcResponseHeader = true;
             Routes();
             Views();
         }

+ 2 - 0
aspnet/src/Web.config

@@ -26,6 +26,8 @@
     </providers>
   </entityFramework>
   <system.web>
+    <!-- Remove X-AspNet-Version HTTP response header -->
+    <httpRuntime enableVersionHeader="false" />
     <!-- Show errors -->
     <customErrors mode="Off"/>
   </system.web>

+ 3 - 0
installer.ps1

@@ -26,6 +26,9 @@ appcmd set config -section:system.webServer/httpErrors -errorMode:Detailed | Out
 # Disable logging
 appcmd set config -section:system.webServer/httpLogging -dontLog:True | Out-Null
 
+# Remove unnecessary X-Powered-By HTTP response header
+appcmd set config -section:system.webServer/httpProtocol /-"customHeaders.[name='X-Powered-By']" | Out-Null
+
 # URL Rewrite
 $rewrite_url = "http://download.microsoft.com/download/6/7/D/67D80164-7DD0-48AF-86E3-DE7A182D6815/rewrite_2.0_rtw_x64.msi"
 $rewrite_local = "$workdir\rewrite_2.0_rtw_x64.msi"