手上一個專案開始使用WCF後,每隔一陣子就發生錯誤,直接使用連結去看MyWCF.svc時,得到以下錯誤:

System.IO.FileNotFoundException: Could not load file or assembly 'App_Web_plmiepuq, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.

看起來似乎是ASP.NET 2.0動態編輯的執行檔案消失了,試過IISRESET無效,手動刪除C:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\WebAppName則可解決(要先停用Web Service,不然檔案會呈現使用中無法刪除),但步驟太複雜了。

目前試出最簡便的方法是重新儲存App_Code\MyWCF.cs,就會強迫重新編譯,問題自然消失,但隔一段時間後(短至10分鐘,長至數小時)又會復發,又得再來一次。這個問題似乎只會發生在存取WCF Service時,其他ASPX則一切正常,懷疑是WCF機制的Bug,但純屬猜測,尚無明確事證。


Comments

# by tom

did you try to publish ASP.NET web site as assembly deploy insteading of deploy source code directly? Maybe it can avoid this issue...I just guess

# by Jeffrey

to Tom, 同意,檔案Build成dll後固定放在bin目錄下,應該就會閃過這個問題。目前是在開發測試期有點小困擾,雖不致命,但有點小煩,我想實際上線時,改部署編譯後的版本,問題應該就會消失。

# by ChrisTorng

我這裡也有同樣的情況說...也是一樣不時就出現。我試出的方法是重建專案可以解決...重新儲存 svc 檔倒是沒試過...

# by alex

今天也遇到同樣的問題,操作步驟如下: 1. 關閉 VS 2008 方案 2. 刪除C:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files 目錄中的所有檔案 3. 重新開啟 VS 2008 方案

Post a comment