问题描述
好的,所以我有一个 Windows 服务,它有一个 FileSystemWatcher
来监视一些 Visual FoxPro 数据库文件的输出文件夹.它利用 VFPOLEDB.1
提供程序来读取这些文件.我不能离开这个提供商,因为它正在生产中使用.
Alright, so I've got a Windows service that has a FileSystemWatcher
that watches an output folder for some Visual FoxPro database files. And it leverages the VFPOLEDB.1
provider to read those files. I cannot go away from this provider because it's being used in production.
但是,我以前从未支持过这个应用程序,所以这就是我的开发箱没有为它设置的原因.这是我的环境:
However, I've never had to support this application before so that's why my development box isn't setup for it. Here is my environment:
- Windows 7 x64
- Visual Studio 2005
- .NET 2.0 Windows 服务
所以,当我第一次开始收到错误时,我认为我根本没有提供程序,我是对的.所以,我下载并安装了它 从这里.
so, when I first started getting the error I figured I just didn't have the provider at all, and I was right. So, I downloaded and installed it from here.
然后我再次将文件放入文件夹中,但我得到了同样的错误.
I then proceeded to drop the files in the folder again, but I got the same error.
我想因为它是一台 x64
机器,我可能在注册时遇到问题,因为它可能被放入 SysWOW64
中,这与我预期的一样,所以我运行这个命令:
I figured because it's an x64
machine I might be experiencing problems with it getting registered since it was probably dropped into SysWOW64
, and it was as I expected, so I ran this command:
regsvr32 "C:WindowsSysWOW64mscomct2.ocx"
它说它已成功注册(这意味着没什么大笑),但我再次将文件放入 - 同样的错误.
and it said it was successfully registered (which means about nothing LOL) but I dropped the files in again - same error.
我还没有重新启动我的机器,如果有人有令人信服的理由,我可以重新启动问题,但一般来说,如果程序集已正确注册 regsvr32
,则没有必要.我已经使用了 吨 的 COM 对象,只要我注册了它,就无需重新启动即可访问该对象.
I have not yet rebooted my machine, and I can if somebody has a compelling reason that's the problem, but generally speaking if the assembly is registered properly with regsvr32
that's not necessary. I've worked with a ton of COM objects and never have to reboot to get to the object as long as I've registered it.
有人知道我需要执行的另一个步骤来注册这个东西吗?
推荐答案
它已按应有的方式注册.为 AnyCPU 平台编译的是您的应用程序.
在 x64 操作系统中,这会产生 64 位代码,而 64 位代码无法访问 32 位驱动程序.
It is registered as it should. It is your application that is compiled for AnyCPU Platform.
In x64 operating system this produces 64bit code and 64bit code could not access 32bit drivers.
将您的平台更改为 x86 就可以了.
Change your Platform to x86 and you will be fine.
编辑
两年后,这个答案有一些补充.现在有了 Visual Studio 2013,奶酪已被移动.链接的文章详细解释了编译器设置默认值是如何更改的.AnyCPU
目标 CPU 与 Prefer 32 位
意味着您的应用程序也可以在 x64 位操作系统中作为 32 位应用程序工作,除非特别需要,否则几乎没有空间给 x64 应用程序.
EDIT
Two years later there is something to add to this answer. Now with Visual Studio 2013 the cheese has been moved. The article linked explain in great details how the compiler setup defaults has been changed. The AnyCPU
target CPU with Prefer 32 bit
means that your application works as 32bit app also in x64bit operating systems leaving practically no-room to x64 application unless specifically required.
有了这个新配置,记住 Mark Berry 在下面的评论中发布的内容也很重要.如果您的(现在是 32 位)应用程序需要在 IIS 64 位环境中工作,您需要使用 Enable 32 bit Applications
With this new configuration becomes also important to remember what is posted in comments below by Mark Berry. If your (now 32bit) app needs to work in a IIS 64bit environment you need to set the Application Pool
with Enable 32 bit Applications
这篇关于收到错误“'VFPOLEDB.1' 提供程序未在本地计算机上注册"即使在安装和注册提供程序之后的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!