异常描述如下:
System.InvalidOperationException: The 'Microsoft.Jet.OLEDB.4.0' provider is not registered on the local machine.
at System.Data.OleDb.OleDbServicesWrapper.GetDataSource(OleDbConnectionString constr, DataSourceWrapper& datasrcWrapper)
at System.Data.OleDb.OleDbConnectionInternal..ctor(OleDbConnectionString constr, OleDbConnection connection)
at System.Data.OleDb.OleDbConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject)
at System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup)
at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
at System.Data.OleDb.OleDbConnection.Open()
at System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable)
at Ipms.Server.DataExchange.FileUpLoadHelper.GetDataFromUploadFile(HttpPostedFile postedFile, HttpContext context, String tableName) in D:\Ipms.Server.DataExchange\FileUpLoadHelper.cs:line 50
at Ipms.Server.DataExchange.ConstructPlanDeviceImport.ConstructPlanDeviceImport.ImportConstructPlanDevice(HttpContext httpContext, HttpPostedFile postedFile, HttpRequest request, Int32 deviceReportID) in D:\ConstructPlanDeviceImport.cs:line 48
at Ipms.WebSite.Service.Office985.OfficeConstructWebService.DeviceImport() in D:\OfficeConstruct.asmx.cs:line 125
原因:OleDb驱动的版本是32位的,而IIS服务器系统的位数为64位。
解决办法:在Application Pools 中配置Enable 32-bit Applications 为True