错误无法加载文件或程序集“ Interop.ActiveDs”

abn*_*317 3 c# asp.net filenotfoundexception active-directory

我正在使用C#执行一些活动目录,并且在页面上收到此错误

System.IO.FileNotFoundException: Could not load file or assembly 'Interop.ActiveDs, Version=1.0.0.0, Culture=neutral, PublicKeyToken=46db4b78e98e1c9d' or one of its dependencies. The system cannot find the file specified.
Run Code Online (Sandbox Code Playgroud)

我在64位计算机上添加的ActiveDS参考存在一些问题,它运行的服务器也是x64

我添加了ActiveDS参考,因此可以执行以下操作

newRoleGroup.Properties["groupType"].Value = ActiveDs.ADS_GROUP_TYPE_ENUM.ADS_GROUP_TYPE_UNIVERSAL_GROUP;
Run Code Online (Sandbox Code Playgroud)

所以我的问题是,为什么它不能加载ActiveDs参考?

Jam*_*son 5

尝试这个:

1)将C:\ Windows \ SysWOW64 \ ActiveDs.dll及其相应的ActiveDs.tlb文件复制到解决方案中的文件夹中;称其为外部参考文件夹

2)在项目中删除对ActiveD的引用

3)添加一个新引用,但是这次不是选择COM版本,而是选择TLB。Visual Studio将为您创建Intero包装器。