[英]Active directory search for all groups and users matching a particular name in c# using System.DirectoryServices.AccountManagement?
[英]C# Active Directory - Migrate to System.DirectoryServices.AccountManagement
我正在嘗試將一些代碼遷移到.NET 3.5中引入的System.DirectoryServices.AccountManagement類
我的舊代碼像這樣工作並繼續工作:
var directoryEntry = new DirectoryEntry("LDAP://{ip address}", "{domain}\\{users}", "{password}", AuthenticationTypes.Secure);
我在同一項目下的同一台計算機上運行的新代碼不起作用:
var principalContext = new PrincipalContext(ContextType.Domain, "{domain}", "ldap://{ip address}/DC=company,DC=local", ContextOptions.Negotiate, "{users}", "{password}");
新代碼將引發錯誤“無法聯系服務器”,並且我認為它應該連接,因為它在同一台計算機上並且在同一Visual Studio項目下運行。
有什么建議么?
在這種情況下,第四個參數的正確輸入僅為DC=company,DC=local
。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.