C# 尽管安装了 Microsoft.ACE.OLEDB.12.0,但未在本地计算机上注册“Microsoft.ACE.OLEDB.12.0”提供程序

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/18461072/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-10 12:15:48  来源:igfitidea点击:

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

c#iisms-officeoledb

提问by Bick

I get the following exception

我收到以下异常

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

though I have installed

虽然我已经安装

'Microsoft.ACE.OLEDB.12.0' 
  • In my local dev machine I have also office 2010
  • 在我的本地开发机器中,我也有 office 2010

What is wrong?

怎么了?

采纳答案by user1335958

If you system is 64 bit,Then you have to change your pool settings to allow 32 bit applications that is OLEDB. ,then this link might help.

如果您的系统是 64 位,那么您必须更改池设置以允许 OLEDB 的 32 位应用程序。,那么此链接可能会有所帮助。

http://help.webcontrolcenter.com/KB/a1114/how-to-enable-32-bit-application-pool-iis-7-dedicatedvps.aspx

http://help.webcontrolcenter.com/KB/a1114/how-to-enable-32-bit-application-pool-iis-7-dedicatedvps.aspx

回答by suizec

I have searched for a solution to this issue for a long time and finally i did find.

我已经搜索了很长时间的解决方案,终于找到了。

My System: IIS (Version 7.5.7600.16385) is running on a 64-bit.

我的系统:IIS(版本 7.5.7600.16385)在 64 位上运行。

First you have to install "AccessDatabaseEngine" you can find the exe below

首先你必须安装“AccessDatabaseEngine”你可以在下面找到exe

http://www.microsoft.com/en-us/download/details.aspx?id=13255

http://www.microsoft.com/en-us/download/details.aspx?id=13255

After you install it to your server you have to do one more thing.

将其安装到服务器后,您还必须做一件事。

Go to your application pool and change "Managed pipeline mode" to Classic.

转到您的应用程序池并将“托管管道模式”更改为经典。

That's it!!

就是这样!!

Now you can use "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=[SOURCE];Extended Properties=Excel 12.0;" connection string

现在您可以使用“Provider=Microsoft.ACE.OLEDB.12.0;Data Source=[SOURCE];Extended Properties=Excel 12.0;” 连接字符串

回答by Pankil Agrawal

convert to data base to .mdb. To convert you .accdb file to .mdb check this link convertand change connection string like this

将数据库转换为 .mdb。要将您的 .accdb 文件转换为 .mdb,请检查此链接转换并像这样更改连接字符串

<add name="ConnectionString4" connectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=d:/HostingSpaces/persistanceplus/doaminname.com/wwwroot/Database3.mdb"/>

this is best solution of this problem.

这是这个问题的最佳解决方案。

回答by druss

It may be problem with your project configuration settings. If it set to Any CPU it cannnot work properly. You should specify x86 or x64 configuration (depends on installed OLE provider version. Detailed instruction here

您的项目配置设置可能有问题。如果它设置为任何 CPU,它就不能正常工作。您应该指定 x86 或 x64 配置(取决于安装的 OLE 提供程序版本。详细说明在这里

回答by RkHirpara

Right click on the project and select the bottom most option that is properties, and uncheck "prefer 32-bit" in build tab

右键单击项目并选择最底部的属性选项,然后在构建选项卡中取消选中“首选 32 位”

enter image description here

在此处输入图片说明

Thanks and Regards, Rk_Hirpara

感谢和问候, Rk_Hirpara