IIS 运行 .net 程序 显示 未在本地计算机上注册“Microsoft.Jet.OleDb.4.0”提供程序 解决方案

最近有一个项目Microsoft.Jet.OleDb,主要用于从Excel中导入数据,在调试阶段一直是正常的。但一部署到客户的环境中(Windows Server 2008 R2 + Server 2005 + IIS7)导入数据的功能就出现问题了

其错误如下:

System.InvalidOperationException: 未在本地计算机上注册“Microsoft.Jet.OleDb.4.0”提供程序。
在 System.Data.OleDb.OleDbServicesWrapper.GetDataSource(OleDbConnectionString constr, DataSourceWrapper& datasrcWrapper)
在 System.Data.OleDb.OleDbConnectionInternal..ctor(OleDbConnectionString constr, OleDbConnection connection)
在 System.Data.OleDb.OleDbConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject)
在 System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup)
在 System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
在 System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
在 System.Data.OleDb.OleDbConnection.Open()
在 ExcelOperation.ImportFromExcel(String fileName, String strSql)
在 Retiree_ImportData.btnImport_Click(Object sender, EventArgs e)
在 System.Web.UI.WebControls.Button.OnClick(EventArgs e)
在 System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)
在 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
在 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

后来了解到客户的操作系统为64位,通过IIS程序池设置中启用32位应用程序选项中设置为True,问题随即解决如下图:


评论

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注