问题
I am getting error "The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine." on my testing servers. So My Question is :
i) Can i add reference for "'Microsoft.ACE.Oledb.12.0.dll'" to project it self? ii) Is it safe? iii) How to do this?
Every thing is working on my local machine since i have latest version of office install in my machine. As soon as i am deploying my code to testing servers i am getting above error. I might not be able to install Office on testing servers (Due to some reason). So is it possible to put all require dll in project itself and deploy that to testing servers too ?
Thanks in advance.
回答1:
In order to use "Microsoft.ACE.OLEDB.12" you need to install the "Microsoft Access Database Engine 2010 Redistributable"
The information page for this is here: http://www.microsoft.com/en-us/download/details.aspx?id=13255
And as @user1297578 quite rightly noted the actual download is here: http://www.microsoft.com/en-in/download/confirmation.aspx?id=13255
Once you have installed that, the actual assembly is called ACEOLEDB.DLL
, the following command at a Command Prompt will find it for you on your system:
C:\>DIR /s/b c:\ACEOLEDB.DLL
c:\Program Files\Common Files\Microsoft Shared\OFFICE14\ACEOLEDB.DLL
For reference, the following is the error message I received from a program until I installed the above redistributable:
Connection Failed.
Error from IDataInitialize::GetDataSource
with connectionString=Data Source=C:\MyFileName.mdb;Mode=Share Deny Write;Provider=Microsoft.ACE.OLEDB.12.0;User Id=admin
OLE DB Error Report:
ErrorRecord:
Hresult=80040154
Description: Class not registered
SQLErrorInfo: No error info available
Source: Microsoft OLE DB Service Components
回答2:
If you want use AccessDatabaseEngine 64 and IIS 64 bit (example windows 2012 64bit), then follow
You must add role asp.net 4.0, .net 4.0 on IIS
Open IIS Manager
Open your site's application pool's advenced setting
Enable 32-bit Applications set to False (must do this, or not iis set to 32 bit engine)
if your site use .net 4.0, then .NET Framework version set to exactly version
6. [this is keypoint!!!] Managed Pipeline Mode set to "Classic"
good luck :)
回答3:
You can get around your problem by adding Microsoft Access Database Engine 2010 as prerequisites in Setup project, The following link shows you how to do so, but be careful, if you use VS2017 then the path is different, the path for VS2017 is:
"C:\Program Files (x86)\Microsoft SDKs\ClickOnce Bootstrapper\Packages"
not
"C:\Program Files\Microsoft SDKs\Windows\v7.0A\Bootstrapper\Packages"
Also I noticed that in some cases you have to install "AccessDatabaseEngine.exe" not "AccessDatabaseEngine_X64.exe" on user's machine, even if it is a 64-bit windows!!!
Here is the article including a video showing how to do all this in a step by step:
https://csharp-tutorials1.blogspot.com/2017/12/add-microsoft-access-engine-2010-as.html
Best regards
回答4:
To use this lib you need installed Office on computer. If have one you can simply add lib in typical way.
来源:https://stackoverflow.com/questions/18380388/can-we-add-reference-of-microsoft-ace-oledb-12-0-dll-to-project