Search code examples
excelazureoledb

Error on only Azure - 'Microsoft.ACE.OleDb.12.0' provider is not registered on the local machine


I am working with MS Excel files in my web application built in Azure environment. I never run into following error when I am trying to access the excel file on my development fabric. But once I deploy to Azure in cloud, I get this error message.

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

I was under impression that development fabric for Azure is replica of the environment you would expect in Cloud.

Is there something wrong I am doing here? Is ACE.OleDb provider not present in Azure?


Solution

  • The ACE.OLEDb provider isn't installed on the Azure VMs.

    The Development Fabric won't give you an error here simply by its design (which in my opinion, is flawed in this area). Since the Fabric runs as a .NET assembly on your local machine, it has and leverages access to your local GAC. As a result, it can access anything you have installed even when those libraries are not present in the Azure image GAC. So, you aren't really doing anything wrong in terms of using the Dev Fabric, its just that the DevFab in its current state (SDK 1.2) cannot help you deal with assembly dependency (and other details) in the cloud.

    As for the assembly itself, I don't know anything about that provider, the DAC, or Jet Drivers. However, assuming they work simply by DLL reference you should be able to make this happen in Azure, you'll just have to be explicit in your reference.

    1.) Make sure you've selected "Copy Local" on the DLL

    2.) Do some testing (maybe remove the component from your local machine) to ensure the code is accessing the DLL within the bin path for the application, as opposed to the GAC. The standard DLL searching algorithm should guarantee this, but always better to be sure.

    In short, if you can make this work local without that component installed, using just local DLLs, you can replicate in Azure. Otherwise, you're at the mercy of the cloud, so to speak.