我应该如何从Linux中运行单声道的C#应用​​程序访问Active Directory?

时间:2010-04-28 13:46:22

标签: c# active-directory mono ldap

我的代码将在Windows(非单声道)和Linux(单声道)中运行。目前,我正在使用System.DirectoryServices,它在Windows中运行良好。但在Linux中:

System.NullReferenceException: Object reference not set to an instance of an object
  at System.DirectoryServices.DirectorySearcher.InitBlock () [0x00000] 
  at System.DirectoryServices.DirectorySearcher.DoSearch () [0x00000] 
  at System.DirectoryServices.DirectorySearcher.get_SrchColl () [0x00000] 
  at System.DirectoryServices.DirectorySearcher.FindOne () [0x00000] 
  at (wrapper remoting-invoke-with-check) System.DirectoryServices.DirectorySearcher:FindOne ()

3 个答案:

答案 0 :(得分:2)

免责声明:我自己没有这样做,但是......

Microsoft的System.DirectoryServices命名空间的实现基本上是他们专有DLL的包装。 Mono项目已投入大量精力使其DirectoryServices代码不仅仅适用于Microsoft AD,但它可能还没有“全部存在”。

我已经看到至少a few people更喜欢使用Novell's Open Source library for LDAP访问权限; a full and detailed tutorial is available here

答案 1 :(得分:1)

RemObjects在其Internet Pack for .NET中也有一个LDAP实现,

http://blogs.remobjects.com/blogs/ck/2010/02/08/p1043

答案 2 :(得分:0)

除此之外,您可能还想尝试hacking Novell example解决方案; I think它位于“not yet implemented category”下。

alt text http://img441.imageshack.us/img441/2368/test12i.jpg