文章目錄
- Server Error in '/' Application.
之前在32位Windows 2008下編譯的asp.net應用程式部署到64位的Windows下,部署上去以後,首頁還可以運行,但是該應用程式還用了oledb去訪問access資料庫. 結果出現了如下錯誤資訊:
Server Error in '/' Application.
The 'Microsoft.Jet.OLEDB.4.0' provider is not registered on the local machine.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidOperationException: The 'Microsoft.Jet.OLEDB.4.0' provider is not registered on the local machine.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[InvalidOperationException: The 'Microsoft.Jet.OLEDB.4.0' provider is not registered on the local machine.] System.Data.OleDb.OleDbServicesWrapper.GetDataSource(OleDbConnectionString constr, DataSourceWrapper& datasrcWrapper) +1818735 System.Data.OleDb.OleDbConnectionInternal..ctor(OleDbConnectionString constr, OleDbConnection connection) +148 System.Data.OleDb.OleDbConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject) +100 System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup) +45 System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +6264718 System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +6265031 System.Data.OleDb.OleDbConnection.Open() +47 Microsoft.ApplicationBlocks.Data.OleDbHelper.PrepareCommand(OleDbCommand command, OleDbConnection connection, OleDbTransaction transaction, CommandType commandType, String commandText, OleDbParameter[] commandParameters) in E:\mydotnet\WorkCopy\DAAB\OleDbHelper.cs:106 Microsoft.ApplicationBlocks.Data.OleDbHelper.ExecuteDataset(OleDbConnection connection, CommandType commandType, String commandText, OleDbParameter[] commandParameters) in E:\mydotnet\WorkCopy\DAAB\OleDbHelper.cs:486 DataAccess.DALUserLogins.FindUserByName(OleDbConnection conn, String username) in D:\mydotnet\WorkCopy\TemplateCompile\DALUserLogins.cs:122 TemplateCompile._Default.btnLogin_Click(Object sender, EventArgs e) in D:\mydotnet\WorkCopy\TemplateCompile\Default.aspx.cs:32 System.Web.UI.WebControls.Button.OnClick(EventArgs e) +115 System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +140 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +29 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2981
Version Information: Microsoft .NET Framework Version:2.0.50727.4927; ASP.NET Version:2.0.50727.4927
在網路上搜尋了半天,暫時沒有找到答案,然後想是不是沒有裝MDAC,但是已經裝了Sql Server 2008的用戶端,這個oledb的驅動沒有可能不隨Sql Server 2008的用戶端安裝的。還是從IIS上找原因。記得該程式是在32位作業系統上編譯的,這個問題可能與32位有關,而當前系統是64位的。於是在IIS管理器裡面找與32相容有關的設定。找來找去,終於找到點眉目:
首先找到該網站所對應的應用程式集區:
再找到該應用程式集區的進階設定:
將”Enable 32 Bit Applications”開啟。再將此應用程式集區重啟一下。發現上述問題就解決了。