我有一段時間(幾天)正常工作的Web應用程序,然後在實例化引用外部DLL的類時開始拋出FileLoadException。組裝FileLoadException(訪問被拒絕)在一段時間後
- 我沒有顯式加載程序集與任何程序集靜態方法。我只是實例化一個類,它自己實例化引用庫中的類。
- 我運行進程監視器,並只監視應用程序路徑。我只收到發生錯誤的源代碼文件的「PATH NOT FOUND」結果(在調試模式下編譯,所以我認爲這只是.NET的一部分,試圖顯示轉儲堆棧跟蹤時發生錯誤的行)
- 這是在內部的專用服務器上運行。該應用程序運行在.NET 3.5應用程序池以及使用相同引用的dll創建的另一個網站上。另一個網站有更多的流量,但從來沒有得到這個錯誤。
- 該應用程序在3個Web服務器之間進行負載均衡,所有3個服務器都在某個時間點出現此問題。
我打開了其中一個Web服務器上的程序集綁定日誌記錄。這裏是堆棧跟蹤的樣子:
System.Web.HttpUnhandledException: Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> System.IO.FileLoadException: Could not load file or assembly 'Project.Library, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. Access is denied.
File name: 'Project.Library, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'
at ...
at System.Web.UI.Control.OnLoad(EventArgs e)
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
Assembly manager loaded from: C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\mscorwks.dll
Running under executable c:\windows\system32\inetsrv\w3wp.exe
--- A detailed error log follows.
=== Pre-bind state information ===
LOG: User = Unknown
LOG: DisplayName = Project.Library, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
(Fully-specified)
LOG: Appbase = file:///C:/websites/ProjectPath/
LOG: Initial PrivatePath = C:\websites\ProjectPath\bin
Calling assembly : WebApp, Version=1.0.3723.37743, Culture=neutral, PublicKeyToken=null.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\websites\ProjectPath\web.config
LOG: Using host configuration file: \\?\c:\windows\microsoft.net\framework\v2.0.50727\aspnet.config
LOG: Using machine configuration file from C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/Temporary ASP.NET Files/root/d77c161e/8751390/Project.Library.DLL.
LOG: Attempting download of new URL file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/Temporary ASP.NET Files/root/d77c161e/8751390/Project.Library/Project.Library.DLL.
LOG: Attempting download of new URL file:///C:/websites/ProjectPath/bin/Project.Library.DLL.
ERR: Failed to complete setup of assembly (hr = 0x80070005). Probing terminated.
--- End of inner exception stack trace ---
at System.Web.UI.Page.HandleError(Exception e)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest()
at System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context)
at System.Web.UI.Page.ProcessRequest(HttpContext context)
at ASP.myaccount_home_aspx.ProcessRequest(HttpContext context)
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
我不是很熟悉的調試文件加載異常,因此任何幫助是極大的讚賞(還有什麼我可以做調試等)。
謝謝。
這是什麼意思,更新客戶服務?我有這個問題,我想模仿。我正在處理的應用程序是SQL Server Reporting Services(沒有簡單的IIS配置,自包含,需要配置文件進行配置)。 – Aaron 2016-08-02 15:51:57