這幾天為了給客戶示範我們的項目,發現原來程度在開發環境和部署環境中還不太一樣,原本在開發環境中程度啟動並執行好好的,而部署後裝在伺服器則可能產生不少的錯誤。因此記錄下所遇到的問題,方便以後查詢同時也希望能幫遇到相關問題的朋友儘快解決問題或者避免這類的問題出現,經過google,baidu後得出一些相關的結論:
一、 如果你的程度用到水晶報表,那就需要為伺服器部署所需要的環境或程式集,否則部署後程式會出現以下錯誤:
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 'CrystalDecisions.Web, Version=10.2.3600.0, Culture=neutral, PublicKeyToken=692fbea5521e1304' or one of its dependencies. 系統找不到指定的檔案。
Source Error:
Line 85: </pages>
Line 86: <httpHandlers>
Line 87: <add verb="GET" path="CrystalImageHandler.aspx" type="CrystalDecisions.Web.CrystalImageHandler, CrystalDecisions.Web, Version=10.2.3600.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
Line 88: </httpHandlers>
Line 89: <sessionState timeout="360"></sessionState>
Source File: c:"inetpub"wwwroot"yuexiusf"web.config Line: 87
Assembly Load Trace: The following information can be helpful to determine why the assembly 'CrystalDecisions.Web, Version=10.2.3600.0, Culture=neutral, PublicKeyToken=692fbea5521e1304' could not be loaded.
WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM"Software"Microsoft"Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM"Software"Microsoft"Fusion!EnableLog].
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.42
解決方案:
1、在你的開發環境中找到Visual Studio安裝目錄下的"SDK"v2.0"BootStrapper"Packages"CrystalReports,將安裝檔案CRRedist2005_x86.msi,複製到伺服器中並安裝。
2、如果程式還不能運行,需要將水晶報表的五個dll檔案複製到你的網站下的bin目錄,其五大將的名稱如下:
CrystalDecisions.CrystalReports.Engine.dll
CrystalDecisions.ReportSource.dll
CrystalDecisions.Shared.dll
CrystalDecisions.Web.dll
CrystalDecisions.Windows.Forms.dll
那麼他們身在何處呢?答:“在你的開發環境中C:"Program Files"Common Files"Business Objects"2.7"Managed"目錄下”
二、如果你的項目中用了excel或者word編程時,可能會出現以下錯誤:Could not load file or assembly 'Microsoft.Office.Interop.Word'
Parser Error Message: Could not load file or assembly 'Microsoft.Office.Interop.Word, Version=11.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' or one of its dependencies. The system cannot find the file specified.
Source Error:
Line 27: <compilation debug="false">
Line 28: <assemblies>
Line 29: <add assembly="Microsoft.Office.Interop.Word, Version=11.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"/>
Line 30: <add assembly="Office, Version=11.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"/>
Line 31:
解決方案:
1、 網上說在http://www.microsoft.com/downloads/details.aspx?FamilyId=3C9A983A-AC14-4125-8BA0-D36D67E0F4AD&displaylang=en,下載個O2003PIA.EXE檔案安裝就行了,但我試了還是不行,或許我沒有留心看其解決的方法,知道的同志麻煩說一聲。
2、後來我乾脆在服務上裝上了office2003,問題就問題就搞定了(雖然這樣做不是很好)
三、關於登入頁面的命名,如果你的頁面中有個叫login.aspx的話,網站部署後可能會出現這樣的錯誤 :Server Error in '/XX' Application.
--------------------------------------------------------------------------------
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS0030: Cannot convert type 'ASP.login_aspx' to 'System.Web.UI.WebControls.Login'
Source Error:
Line 112: public login_aspx() {
Line 113: string[] dependencies;
Line 114: ((Login)(this)).AppRelativeVirtualPath = "~/login.aspx";
Line 115: if ((global::ASP.login_aspx.@__initialized == false)) {
Line 116: dependencies = new string[1];
Source File: c:"WINDOWS"Microsoft.NET"Framework"v2.0.50727"Temporary ASP.NET Files"XX"d41012e3"4462d393"App_Web_login.aspx.cdcab7d2.ip6y7oyd.0.cs Line: 114
原因:
這是因為.net2.0中有一個叫login的控制項,這樣.netframework就不知道她應該選擇哪個好,把你的的頁面強制轉換成她內建的控制項,就出錯了。
解決方案:
1、不要取login這樣的頁面名稱
2、如果你不想改頁面的名稱,在其cs檔案中加上命名空間,或者改其class Name如改成“User_Login”,最後不要忘了在aspx頁面中改其引用如:<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Login.aspx.cs" Inherits="User_Login" %>
如果你通過以上的方法還解決不了,提議開啟C:"WINDOWS"assembly
看看相應的程式集的version是不是對上號了