Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

        <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

like image 947
Kyabroudi Avatar asked Jun 24 '12 18:06

Kyabroudi


People also ask

How do I install Microsoft ACE Oledb 12.0 provider?

Download Microsoft.ACE.OLEDB.12.0 provider Once you click Download it will prompt you to select the architecture i.e. 32 BIT (x86) or 64 BIT (x64). Once downloaded, just right click the Microsoft Access Database Engine 2010 Redistributable file and click install and restart the machine after installation is completed.

How do you check Microsoft ACE Oledb 12.0 is installed or not?

Navigate to Start, and enter C:\Windows\System32\odbcad32.exe into the Search programs and files field. When the ODBC Administrator opens, click the Drivers tab and look for Microsoft Excel Driver or Microsoft Access Driver. If these drivers are present, this confirms the existence of 64-bit ACE components.


2 Answers

For version 12.0 you need to install MDAC 2010 from here.

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.

like image 155
Marcel N. Avatar answered Oct 12 '22 19:10

Marcel N.


As suggested in here You need to change the Solution Platform from "Any CPU" to "x86".

like image 41
Mohsen Afshin Avatar answered Oct 12 '22 18:10

Mohsen Afshin



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!