"Microsoft.ACE.OLEDB.12.0"提供程序未在本地计算机上注册.

Kya*_*udi 32 c# asp.net web-config ms-access-2007

每件事在本地工作正常,但发布时出现此错误:

 The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine.
Run Code Online (Sandbox Code Playgroud)

和堆栈跟踪

[InvalidOperationException: The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine.]
System.Data.OleDb.OleDbServicesWrapper.GetDataSource(OleDbConnectionString constr, DataSourceWrapper& datasrcWrapper) +1027372
System.Data.OleDb.OleDbConnectionInternal..ctor(OleDbConnectionString constr, OleDbConnection connection) +337
System.Data.OleDb.OleDbConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject) +86
System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup) +31
System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +76
System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +126
System.Data.OleDb.OleDbConnection.Open() +43
System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +123
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +319
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable) +92
System.Web.UI.WebControls.SqlDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) +1618
System.Web.UI.WebControls.ListControl.OnDataBinding(EventArgs e) +97
System.Web.UI.WebControls.ListControl.PerformSelect() +34
System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +74
System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +66
System.Web.UI.WebControls.ListControl.OnPreRender(EventArgs e) +29
System.Web.UI.Control.PreRenderRecursiveInternal() +103
System.Web.UI.Control.PreRenderRecursiveInternal() +175
System.Web.UI.Control.PreRenderRecursiveInternal() +175
System.Web.UI.Control.PreRenderRecursiveInternal() +175
System.Web.UI.Control.PreRenderRecursiveInternal() +175
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2496
Run Code Online (Sandbox Code Playgroud)

我正在使用MS access 2007数据库,这是我在web.config中的连接字符串

        <add name="ConnectionString" connectionString="Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\OmanLegalDB.accdb;Persist Security Info=True" providerName="System.Data.OleDb"/>
Run Code Online (Sandbox Code Playgroud)

对此问题的任何建议

Mar*_* N. 41

对于12.0版,您需要从此处安装MDAC 2010 .

这必须在您发布应用程序的服务器上完成.如果目标计算机是32位,则需要安装x86版本;如果目标计算机是64位,则需要安装x64版本,并且应用程序是使用配置构建的Any CPU.


Moh*_*hin 10

如建议在这里您需要的解决方案平台,从"改变任何CPU "到" 86 ".