-
WCF Service的不定期錯誤
-
手上一個專案開始使用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,但純屬猜測,尚無明確事證。