開發環境:XP-sp2; VS 2005; IIS 5.1; ASP.NET 2.0 AJAX Extensions
測試環境:Windows Server 2003-sp1; IIS 6.0;
在本地我們調試運行AJAX.NET程式完全沒有問題,但是一旦上傳到伺服器就會出現很多Web.config檔案異常。以下是兩個最為典型的異常資訊:
Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
Parser Error Message: Could not load file or assembly 'System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. 系統找不到指定的檔案。
Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
Parser Error Message: Could not load file or assembly 'System.Web.Extensions.Design, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. 系統找不到指定的檔案。
這個問題產生的原因還是出在微軟本身,原本我們發布網站的時候都會自動產生dll檔案到程式的bin目錄。但是AJAX.NET 1.0無法自動添加關鍵dll檔案到bin目錄。因此需要我們手動添加。
方法很簡單,找到你安裝AJAX.NET 1.0的目錄,一般是C:\Program Files\Microsoft ASP.NET\ASP.NET 2.0 AJAX Extensions\v1.0.61025
把裡面的System.Web.Extensions.dll檔案和System.Web.Extensions.Design.dll檔案複製到bin目錄下就可以了。當然複製哪個檔案要看你Web.config檔案的異常資訊而定。