在尝试解析跨存储引用时,无法解析目标主体的SID

时间:2017-03-20 13:47:45

标签: c# groupprincipal

我有一个如下代码示例

command

我正在尝试使用群组来查找其成员。有些成员来自其他受信任的森林,所以我不能使用用户的'成员'..

我有几个服务器的环境是服务器2008,2008 R2和2012等...

应用程序可以正常运行,但某些服务器会引发异常。

一个是

PrincipalContext context = new PrincipalContext(ContextType.Domain, "aaaaa", "aaaa\\bbb", "pppppp");
var group = GroupPrincipal.FindByIdentity(context, IdentityType.Guid, "253DD8F5-3C6E-438A-899F-8A693B0AD93E");
PrincipalSearchResult<Principal> users = group.GetMembers(true);
foreach (UserPrincipal user in users)
{
 var a =user.Sid.Translate(typeof(NTAccount)).ToString();
}

这个是因为sid无法翻译.....但其他服务器还可以....

另一个是

System.Security.Principal.IdentityNotMappedException: Some or all identity references could not be translated.

这是因为无法访问搜索结果

0 个答案:

没有答案