How to Install Microsoft Ace Oledb 12.0 Provider
Solved - The Microsoft.ACE.OLEDB.12.0 provider is not registered on the local machine
There are a number of reasons why you might get "The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine" error when attempting to connect to either an accdb or an xlsx file, depending on what you are doing. This article discusses some of the causes and provides solutions first for uses involving ASP.NET, and then looking at other application uses.
First, I will dispense with the most obvious reason for the error, and that is that the provider hasn't been registered on the machine on which the application is running. The ACE provider is not installed on Windows operating systems by default. You have to install it. The ACE provider is available in three forms: Microsoft Office Access database engine 2007 , the Microsoft Access Database Engine 2010 Redistributable and the 2016 Distributable . The 2007 version is only available as a 32-bit component whereas the 2010 and 2016 versions offer both 32 and 64-bit options. You need to be careful which option you choose, because a wrong choice here is the most frequent cause for the error message.
ASP.NET Applications
If you get this error when trying to use ACE from an ASP.NET application, the most likely cause is that you have installed either one of the 32-bit versions. By default, IIS on a 64-bit operating system will run applications in a 64-bit worker process. 64-bit processes cannot load 32-bit DLLs. When a call is made to the ACE provider, the 64 bit process will attempt to locate a 64-bit DLL. If it doesn't exist, you get the error message that brought you here.
In this case you have two options. First, you can install the 2010 or 2-16 64-bit version. If you have the 2007 32-bit version installed, you can simply install the 64-bit version alongside it. If you have the 32-bit version of 2010 or 2016 installed, you need to uninstall it and download and install the 64-bit version instead. You cannot have both the 32- and 64-bit versions of the same provider installed at the same time. If you are performing the installation on your development machine, you may also be constrained by the bit-ness of any existing Office installations.
The second option is to change the application pool in IIS to enable 32-bit applications. If you are using the full version of IIS, you can use the management tool to do this (Control Panel » Administrative Tools » Internet Information Services (IIS) Manager).
Click on Application Pools in the left pane, then select the application pool for the relevant site in the centre pane, and click Advanced Settings on the right:
Locate the Enable 32-bit Applications entry and change False to True:
IIS Express
IIS Express 7.5 only comes as a 32-bit application. Therefore the 64-bit version of ACE will not work with it. IIS 8 or greater offer both 32-bit and 64-bit options, so you can download that instead. There is no option to enable 32-bit applications in current versions of IIS Express. However, by default, Visual Studio uses the 32-bit version. You can change this from within Visual Studio by going to Tools » Options » Projects And Solutions » Web Projects » General, and choosing the appropriate option circled below:
If you launch IIS Express from the command line instead, navigate to the correct folder instead. The 32-bit version is installed by default in C:\Program Files (x86)\IIS Express
. The 64-bit version is installed in C:\Program Files\IIS Express
. You can determine which version of IIS Express is running from the Processes tab in Task Manager:
The 32-bit version is denoted by *32
as part of the Image Name.
Other Applications
Visual Studio is only available as a 32-bit application. If you try to connect to Access from within Visual Studio, you must have a 32-bit version of ACE installed. The same is true of SQL Server Data Tools, which you might use for creating SSIS packages. For other applications, you should check the bit-ness to ensure that you have an appropriate version of the provider installed. As I have already mentioned, it is perfectly possible to have both a 32-bit and a 64-bit version installed at the same time, so long as they are not both from the 2010 download site.
Alternatives
It might be that you do not have access to the IIS server to either install a version of ACE or make changes to the enable 32 bit applications. You can use the JET provider instead, which still forms part of the Windows operating system. This is only useful if you can enable 32-bit applications (or have it enabled) but can't install anything on the server. You will need to resave your accdb files to mdb files (Access 2002-2003 Database) instead. This will be fine if you haven't used any of the features that were added to Access in 2007 such as BLOBs and multi-valued fields. Excel files can simply be resaved as Excel 97-2003 Workbook (.xls). Alternatively, you can use the EPPlus library to work with Excel files in .xlsx format. It's free, open source and can be deployed with your application, removing the need to install anything.
Summary
This article looked at the reasons behind the 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine error, and discussed the fact that most problems are caused by the incorrect bit-ness of the selected component. The article discussed strategies for resolving the issue, and possible workarounds if it is not possible to put the proposed resolutions into effect.
How to Install Microsoft Ace Oledb 12.0 Provider
Source: https://www.mikesdotnetting.com/article/280/solved-the-microsoft-ace-oledb-12-0-provider-is-not-registered-on-the-local-mach