我似乎无法找到某个用户是DeployUsersProduction组的成员。这是我到目前为止所拥有的:
[OperationBehavior(Impersonation = ImpersonationOption.Required)]
public Modes GetDeployMode()
{
bool isProd = false;
WindowsIdentity windowsIdentity = WindowsIdentity.GetCurrent();
if (windowsIdentity == null || windowsIdentity.Groups == null) { return Modes.DUS; }
foreach (IdentityReference identityReference in windowsIdentity.Groups)
{
try
{
var reference = identityReference;
string group = reference.Translate(typeof (NTAccount)).Value.Trim();
if (!String.Equals(group, "DeployUsersProduction", StringComparison.OrdinalIgnoreCase)) { continue; }
isProd = true;
break;
}
catch (Exception ex)
{
// Silent catch due to the [Some or all identity references could not be translated]
// error that sometimes occurs while trying to map an identity.
}
}
return isProd ? Modes.Prod : Modes.DUS;
}
据我所知,我的所有配置、spn、db、perms 等都是正确的。我只有一个用户应该返回 Modes.Prod 而不是。