web-dev-qa-db-fra.com

Le fournisseur «Microsoft.ACE.OLEDB.12.0» n'est pas enregistré sur la machine locale.

tout fonctionne bien localement, mais cette erreur se produit lorsque je le publie:

 The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine.

et trace de pile

[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

J'utilise la base de données MS Access 2007 et ma chaîne de connexion dans 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"/>

toutes suggestions pour ce problème

32
Kyabroudi

Pour la version 12.0, vous devez installer MDAC 2010 à partir de ici .

Cela doit être fait sur le serveur sur lequel vous publiez votre application. Vous devez installer la version x86 si la machine cible est 32 bits ou la version x64 si la machine cible est 64 bits et que votre application est construite avec la configuration Any CPU.

40
Marcel N.

Comme suggéré dans ici Vous devez changer la plate-forme de solution de " N'importe quel CPU " en " x86 ".

9
Mohsen Afshin

Votre chaîne de connexion est correcte, cette erreur peut donc être due à la raison suivante:

  • Si votre Office est 32 bits sur une machine 64 bits et que le pilote MDAC installé est 64 bits. Dans ce cas, vous devez installer le pilote MDAC 32 bits pour correspondre aux binaires Office 32 bits.

Ce post a des informations détaillées sur la façon de le dépanner.

3
AvkashChauhan