14

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. Installing 2007 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?

KyleMit
  • 45,382
  • 53
  • 367
  • 544
Bryuk
  • 3,153
  • 10
  • 42
  • 71
  • Thank you all guys! All your answers are right! Unfortunately, I can Accept only 1, but I did upvote to everyone=) – Bryuk Dec 06 '13 at 14:44

5 Answers5

31

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.)

Community
  • 1
  • 1
Heinzi
  • 151,145
  • 51
  • 326
  • 481
  • 9
    If I will see you in my life. I'm gonna kiss you=))) Thanks! That's the last step that I missed! – Bryuk Dec 06 '13 at 14:43
  • 1
    me too.i also face same problem and her answer set me free from pain :) – mgsdew Nov 06 '14 at 11:07
  • 1
    So glad I found this in the beginning...I'm sure you've saved me hours. Thank you – Lopsided Feb 28 '15 at 21:48
  • I had installed ACE OLEDB x86 (32-bit) version, after changing application pool settings of Enable 32-bit Applications to True it worked for me. If you don't want to enable 32-bit mode, please uninstall 32-bit OLEDB and install x-64 bit of OLEDB. – Sudhanshu Shekhar Oct 23 '19 at 04:46
10

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)

Community
  • 1
  • 1
Steve
  • 203,265
  • 19
  • 210
  • 265
  • I just changed to Microsoft.ACE.OLEDB.12.0 and got the same error – Bryuk Dec 05 '13 at 21:51
  • 1
    Now you should be sure to have the ACE engine installed and the ACE engine should be forthe same platform used by your application. Adding the link for the download – Steve Dec 05 '13 at 21:53
  • The new version of Visual Studio had "auto updated" my settings.. I only changed the version numbers back to 4 and didn't even notice the "JET" part changed to "ACE".. This answer was a life safer! – eselk Jul 01 '15 at 20:47
3

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

JC Lizard
  • 1,032
  • 6
  • 17
1

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.
Nathan Tuggy
  • 2,239
  • 27
  • 28
  • 36
1

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