简体   繁体   中英

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

I know that is this question has dozen of answers and posts, but nothing works for me.

I have my MVC 5 application and I deploy it to the IIS 7.5 to my server. Application runs great, everything is works until I go to the Action, where I use ACE.OLEDB.

I'm getting this error:

[InvalidOperationException: The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine.]
System.Data.OleDb.OleDbServicesWrapper.GetDataSource(OleDbConnectionString constr, DataSourceWrapper& datasrcWrapper) +1785474
System.Data.OleDb.OleDbConnectionInternal..ctor(OleDbConnectionString constr, OleDbConnection connection) +1802032
System.Data.OleDb.OleDbConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject) +100
System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup, DbConnectionOptions userOptions) +61
System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection) +964
System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions) +6785863
System.Data.ProviderBase.DbConnectionInternal.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +27
System.Data.OleDb.OleDbConnection.Open() +47
QuickbookUploadFromElite3e.Controllers.HomeController.Matters(String filePath) in c:\Users\alex.chakhau\Documents\Visual Studio 2013\Projects\QuickbookUploadFromElite3e\QuickbookUploadFromElite3e\Controllers\HomeController.cs:75
lambda_method(Closure , ControllerBase , Object[] ) +127
System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +242
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +39
System.Web.Mvc.Async.AsyncControllerActionInvoker.<BeginInvokeSynchronousActionMethod>b__36(IAsyncResult asyncResult, ActionInvocation innerInvokeState) +12
System.Web.Mvc.Async.WrappedAsyncResult`2.CallEndDelegate(IAsyncResult asyncResult) +139
System.Web.Mvc.Async.AsyncInvocationWithFilters.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3c() +112
System.Web.Mvc.Async.<>c__DisplayClass45.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3e() +452
System.Web.Mvc.Async.<>c__DisplayClass30.<BeginInvokeActionMethodWithFilters>b__2f(IAsyncResult asyncResult) +15
System.Web.Mvc.Async.<>c__DisplayClass28.<BeginInvokeAction>b__19() +37
System.Web.Mvc.Async.<>c__DisplayClass1e.<BeginInvokeAction>b__1b(IAsyncResult asyncResult) +241
System.Web.Mvc.Controller.<BeginExecuteCore>b__1d(IAsyncResult asyncResult, ExecuteCoreState innerState) +29
System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +111
System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +53
System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +19
System.Web.Mvc.MvcHandler.<BeginProcessRequest>b__4(IAsyncResult asyncResult, ProcessRequestState innerState) +51
System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +111
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +606
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +288

I found a couple answers on the web and I did the following:

  1. Installing Microsoft Access Database Engine 2010 Redistributable
  2. Installing2007 Office System Driver: Data Connectivity Components

I've tried this:

  1. From the solution explorer right-click your project then click Properties
  2. Click the Build tab
  3. Change Platform target from: Any CPU to x86 | Any CPU to x64
  4. Re-build your solution

Any suggestions?

It's probably a bitness issue, but it's not about the bitness in your Build properties.

The ACE driver is available in two versions: x86 and x64.

  1. You can only install one of them.
  2. If you install the x86 version, only x86 applications can use it. If you install the x64 version, only x64 applications can use it. (Yes, it's stupid.)

Now, whether your web application runs in x86 (32-bit) or x64 mode is not determined by your build settings but by the settings of your application pool : Select the application pool in IIS Manager, go to Properties/Advanced Settings and verify the setting of Enable 32-bit Applications . If it is set, your application runs in x86 mode, otherwise in x64 mode. Make sure it is the same mode as the one of which you installed the ACE driver.

(Of course, Steve's answer about using the right driver name also applies.)

There is no

Microsoft.ACE.OLEDB.4.0

There is

Microsoft.ACE.OLEDB.12.0 

or

Microsoft.JET.OLEDB.4.0

Of course the usual rules about 32bit and 64bit should be applied carefully

See this answer

So you need to install the Access Database Engine redistributable that you can download from here . But you should be careful to download the correct version (32bit or 64bit) depending on the Target Platform choosen to build your app. (AnyCPU, x64, x86).

Of course, if your server has Office installed then you have already the ACE installed, but it could be for a different platform and your application need to be compiled for the same. (Example, Office 32bit then ACE 32bit and you need to compile your app for x86)

probably it is X86 or X64 issue

you need to install it:

2007 Office System Driver: Data Connectivity Components.( http://www.microsoft.com/en-us/download/details.aspx?id=23734 )

then make sure:

BUILD -> Configuration Manager -> Active Solution Platform -> x64 http://www.codeproject.com/Tips/417397/OLEDB-Provider-is-Not-Registered-on-the-Local-Mach

You have to just change the Configuration manager.

Steps:

  1. Right click on your project name in Solution Explorer.
  2. Choose configuration manager.
  3. Once dialog box open, change Active solution platform as new....
  4. Again once dialog box open, choose x86 CPU.
  5. Click OK and close Configuration Manager.
  6. Finally, run your project.

It might look like you have ACE Drivers installed and even changing the Application Pool properties would make the application work.

But you might be missing the Connectivity Driver for your system

Try and install it from this link, it worked for me:

https://download.cnet.com/2007-Office-System-Driver-Data-Connectivity-Components/3000-10254_4-75452798.html

--- after trying to download the Microsoft Access DataEngine and more

I fix this issue by changing the application poll setting for the application >> enable 32-bit applications ( true) >> and restarting the application.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM