IIS應用程序池頻繁崩潰的問題


昨天協助一個朋友處理了他們公司服務器上面IIS應用程序池頻繁崩潰的問題。

1. 錯誤日志文件如下

image

【注意】 該文件位於 C:\WINDOWS\system32\LogFiles\HTTPERR 目錄下

image

另外,IIS還會有一個日志,就是下面屬性窗口中指定的

 

 

image

image image

 

 

分析下來,這個錯誤日志中主要包含了三類錯誤

 

  • 2009-05-30 10:43:27 203.208.60.137 48675 210.192.111.49 80 HTTP/1.1 GET /showroom/vulpes/product-detail/LRPST/Rubber-Series - 2006987705 Connection_Abandoned_By_AppPool MyApplicationPool :這個錯誤是說,連接被強制拋棄。
  • 2009-05-30 11:25:50 211.167.234.158 13284 210.192.111.49 80 - - - - - Timer_ConnectionIdle -
  • 2009-05-30 10:53:05 211.139.116.67 27664 210.192.111.49 80 - - - - - Timer_MinBytesPerSecond - 這兩個錯誤是與時間有關的。

 

 

2. 分析錯誤原因

對於Timer_ConnectionIdle和Timer_MinBytesPerSecond ,可以考慮下面的處理措施

IIS6.0系統日志中出現此錯誤Timer_MinBytesPerSecond,Timer_ConnectionIdle

Description: The Error means The connection with the server has been terminated.

問題描述:這個錯誤是由於服務器連接被中斷導致的。

If you check out the C:"Windows"system32"LogFiles"HTTPERR"httperr*.log files on the distribution server, you'll likely see either Timer_MinBytesPerSecond errors or Timer_ConnectionIdle errors. These are caused by IIS' default settings, contained within its metabase, which define the minimum traffic flow rate for a connection to be kept alive and the maximum idle time allowed before a connection is dropped. For some reason, SUS servers seem to take their good old time while downloading updates, and these parameters are exceeded and the distribution server drops 'em.

這個問題是由於在某些應用下,IIS的默認設置不當的

1) From IIS Manager, right click on the Internet Information Server (IIS) Manager root level folder and go to Properties. Check the box to enable direct metabase editing. Click OK.

1)打開Internet 信息服務(IIS)管理器,右鍵點“我的計算機”——屬性,選上“允許直接編輯配置數據庫(N)”,確定。

2) Open the C:\Windows\system32\inetsrv\MetaBase.xml file in Notepad. Do a search for "MinFileBytesPerSec". Change the setting for MinFileBytesPerSec from 240 to 0. Do another search, this time for "ConnectionTimeout" to be 600. Save changes and exit.

2)編輯C:"Windows"system32"inetsrv"MetaBase.xml文件,把MinFileBytesPerSec 參數值從240改為0,把ConnectionTimeout參數設成600。

3) Restart the IIS Admin service to effect the changes.

對於Connection_Abandoned_By_AppPool 的錯誤,經過分析大多都是因為應用程序本身的異常導致了程序池的工作進程不斷重啟。為此,我用了一個global.asax文件,來接管所有未處理的異常

<%@ Application  Language="C#" %>
<%@ Import Namespace="System.IO" %>

<script RunAt="server">
    protected void Application_Error(object sender, EventArgs e)
    {
        string errorLog = Server.MapPath("Error.log");
        FileStream fs = new FileStream(errorLog,FileMode.Append,FileAccess.Write);
        StreamWriter sw = new StreamWriter(fs);

        sw.WriteLine("時間:{0},錯誤消息:{1},地址:{2}", DateTime.Now.ToString(), Server.GetLastError().InnerException.Message,Request.Url.AbsolutePath);
        Server.ClearError();

        sw.Close();
    }
</script>

同時,一定要確保web.config中將調試模式設置為false

image

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM