【发布时间】:2020-05-17 00:36:35
【问题描述】:
我正在构建一个 .net core 3 网站,尝试将用户添加到 Active Directory 安全组。以下代码在我的开发环境中运行良好,但一旦部署到 IIS,我就会收到:
System.DirectoryServices.DirectoryServicesCOMException (0x8007202B): 从服务器返回了一个推荐。
错误发生在“group.Save();”
using (PrincipalContext pc = new PrincipalContext(ContextType.Domain, "ad.xxx.com:389",
"DC=ad,DC=xxx,DC=com", svcAccountUsername, svcAccountPw))
{
GroupPrincipal group = GroupPrincipal.FindByIdentity(pc, IdentityType.SamAccountName, groupName);
group.Members.Add(pc, IdentityType.SamAccountName, username);
group.Save();
}
同样,这在我的开发环境中本地工作,但一旦部署到 IIS 就不行。有关如何修复的任何建议?
【问题讨论】:
标签: asp.net-core iis .net-core active-directory directoryservices