[英]The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine.
every thing work fine locally but this error occurs when I publish it:在本地一切正常,但在我发布时出现此错误:
The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine.
and stack trace和堆栈跟踪
[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
I am using MS access 2007 database and this my connection string within web.config我正在使用 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"/>
any suggestions for this problem对这个问题的任何建议
For version 12.0 you need to install MDAC 2010 from here .对于 12.0 版,您需要从 此处安装 MDAC 2010。
This has to be done on the server where you publish your application.这必须在您发布应用程序的服务器上完成。 You need to install the x86 version if the target machine is 32 bit or the x64 version if the target machine is 64 bit and your application is built with configuration
Any CPU
.如果目标机器是 32 位,则需要安装 x86 版本;如果目标机器是 64 位,则需要安装 x64 版本,并且您的应用程序是使用
Any CPU
配置构建的。
Your connection string is right so this error could be caused by following reason:您的连接字符串是正确的,所以这个错误可能是由以下原因引起的:
This post has detailed info on how to troubleshoot it.这篇文章有关于如何解决它的详细信息。
If you don't want to download anymore add on's another fix I've found is changing ACE to JET and 12 to 4.如果您不想再下载,请添加我发现的另一个修复程序,将 ACE 更改为 JET,将 12 更改为 4。
'Microsoft.JET.OLEDB.4.0'
You then also need to make sure that you change the database from.accdb to.mdb format and that should work.然后,您还需要确保将数据库格式从 .accdb 更改为 .mdb,这样应该可以正常工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.