How to fix The microsoft.ACE.OLEDB.12.0 provider is not registered on the local machine (Azure) for Access Database

Ed Choi 45 Reputation points
2023-06-27T01:24:27.2466667+00:00

Connection to ACCESS database fails with exception:

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

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
7,677 questions
{count} votes

4 answers

Sort by: Most helpful
  1. Ed Choi 45 Reputation points
    2023-07-02T15:38:43.9933333+00:00

    Problem

    ACCESS database connection failure on an app in Azure Web Service:

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

    The 'Microsoft.Jet.Ole8db.4.0' provider is not registered on the local machine.

    Background

    Microsoft recognizes that the error is by design as we do not install the Microsoft.Ace.we.12.0' driver. The Microsoft.Ace drivers are not supported in server side environments and as of now there is no plans to add these to the Azure Web Sites.

    My working solution

    The solution is complex, but it is working at least.

    Step 1) Separate connection strings for the 64-bit source (on PC) and 32-bit target (Azure)

    Connection String for 64-bit environment:

    "Provider=Microsoft.ACE.OLEDB.12.0;" & "Data Source=" & sMdb & ";" & "Jet OLEDB:Database Password=" & sPass & ";" & "Persist Security Info=True;"

    Connection String for 32-bit target environment:

    "Provider=Microsoft.Jet.Ole8db.4.0;" & "Data Source=" & sMdb & ";" & "Jet OLEDB:Database Password=" & sPass & ";" & "Persist Security Info=True;"

    Step 2) Adjust Registry Editor

    In the search box on the taskbar, type “regedit” to open Registry Editor and adjust

    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Fusion

    Add:

    DWORD ForceLog set value to 1

    DWORD LogFailures set value to 1

    DWORD LogResourceBinds set value to 1

    DWORD EnableLog set value to 1

    String LogPath set value to folder for logs (e.g. C:\FusionLog)

    (reference: https://stackoverflow.com/questions/255669/how-to-enable-assembly-bind-failure-logging-fusion-in-net)

    Step 3) Switch settings when deploying to Azure

    1. Compiler settings

    Change Project / Property / Compile / Target CPU to “x86”

    1. Menu bar - Build / Configuration Manager

    Change Platform to "x86"

    1. IIS – Application Pools

    Change Enable 320Bit Applications to “True” 

     

    Step 4) Switch settings back to 64-bit development PC environment

    1. Compiler settings

    Change Project / Property / Compile / Target CPU to “Any CPU”

    1. Menu bar - Build / Configuration Manager

    Change Platform to "Any CPU"

    1. IIS – Application Pools

    Change Enable 320Bit Applications to “False” 

     

    1 person found this answer helpful.

  2. Val Macduff 5 Reputation points
    2024-03-05T07:24:10.1933333+00:00

    For anyone developing in Visual Studio the answer is to uncheck Prefer 32-bit in the project properties compile page.

    1 person found this answer helpful.
    0 comments No comments

  3. SnehaAgrawal-MSFT 21,346 Reputation points
    2023-06-30T06:04:46.86+00:00

    @Ed Choi

    Apologies for facing issue on this! If you are receiving the following error on your Azure Web Site

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

    The error is by design as we do not install the Microsoft.Ace.we.12.0' driver.
    The Microsoft.Ace drivers are not supported in server side environments and as of now there is no plans to add these to the Azure Web Sites.

    Workaround-

    This leaves the option of using the Jet Drivers which are installed, however these are only available in 32 bit versions so you will have to configure your site to run in 32 bit versions. The Microsoft OLE DB Provider for Jet and the Microsoft Access ODBC driver are available in 32-bit versions only:    http://support.microsoft.com/kb/957570/en-us

    This is also discussed here: Data Access Technologies Road Map http://msdn.microsoft.com/en-us/library/ms810810.aspx#bkmk_DepMDAC_WDACComps

    Also, you could use Windows Containers to install these drivers.
    Quickstart: Run a custom container on App Service - Azure App Service | Microsoft Learn

    Further if you wish you may share your feedback on Azure Web App Uservoice -

    All of the feedback, you share in these forums will be monitored and reviewed by the Microsoft engineering teams responsible for building Azure. Additionally, users with a similar request can up-vote you post and add their comments.

    Please let us know, if you have further query or issue remains.

     


  4. TT 20 Reputation points
    2024-09-09T22:11:26.6766667+00:00

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.