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

前端 未结 4 1995
抹茶落季
抹茶落季 2021-01-14 05:47

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 developme

相关标签:
4条回答
  • 2021-01-14 06:23

    The development fabric is as close an approximation of what you get on the cloud, without having to run a virtual machine on your development machine.

    When you run code in the development fabric it has access to all of the components that are installed on your machine. The machine that your code runs on in the cloud only has a very minimal install on it. It's more or less a clean install of Windows Server 2008 (IIS will be running if it's a web role).

    Any code that you deploy to Azure needs to be able to run if all you did was build the project, copy the build files to a new machine and run it. As such if this component you're trying to use is just a .Net assembly, change the reference so that it has "Copy Local" set to true and this should work. If to get your code to work requires you to actually install something, I'd look for a different way of doing things.

    0 讨论(0)
  • 2021-01-14 06:26

    That means the DAC is not installed (Data access component).

    http://www.microsoft.com/downloads/en/details.aspx?familyid=7554f536-8c28-4598-9b72-ef94e038c891&displaylang=en

    Don't know about Windows Azure however.

    0 讨论(0)
  • 2021-01-14 06:40

    I also faced the same issue today. I am using Standard plan of Azure and access to deployment server is through Azure Web portal. I am not using Azure VM because it is a costlier option.

    One of my colleagues suggested to use OpenSDK, using which I ultimately could do Excel manipulation without using OleDb drivers.

    Some of the resources which helped me to accomplish what I wanted are these:

    1. https://www.microsoft.com/en-us/download/details.aspx?id=30425
    2. https://msdn.microsoft.com/en-us/library/office/hh298534.aspx?cs-save-lang=1&cs-lang=csharp#code-snippet-15
    3. reading Excel Open XML is ignoring blank cells

    Please make sure open sdk dll is copied to local. In my case, it was referencing the dll installed in my computer in program files. So when I uploaded to Azure, it gave a dll missing error. I had copy the dll separately to the bin folder. I think if we try nuget option of referencing the dll then this issue would not show up, 've not tried it myself though.

    Hope this helps someone who is looking for an alternative to Oledb, in case where installation of the dll on the server is not possible.

    0 讨论(0)
  • 2021-01-14 06:43

    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.

    0 讨论(0)
提交回复
热议问题