【问题标题】:Windows Authentication in IIS 7.5 Fails with Trust Relationship ExceptionIIS 7.5 中的 Windows 身份验证因信任关系异常而失败
【发布时间】:2010-11-18 14:39:48
【问题描述】:

我有一个 ASP.Net 2.0 应用程序,它使用集成的 Windows 身份验证来验证/授权用户。该应用程序在 Windows XP/IIS 5.1、Windows Server 2008/IIS 7 和 Windows Vista/IIS 7 上运行良好。当我尝试在 Windows 7/IIS 7.5 上运行此应用程序时,出现以下异常:The trust relationship between this workstation and the primary domain failed.

堆栈跟踪如下:

[SystemException: The trust relationship between this workstation and the primary domain failed.
]
   System.Security.Principal.NTAccount.TranslateToSids(IdentityReferenceCollection sourceAccounts, Boolean& someFailed) +1085
   System.Security.Principal.NTAccount.Translate(IdentityReferenceCollection sourceAccounts, Type targetType, Boolean forceSuccess) +46
   System.Security.Principal.WindowsPrincipal.IsInRole(String role) +128
   System.Web.Configuration.AuthorizationRule.IsTheUserInAnyRole(StringCollection roles, IPrincipal principal) +229
   System.Web.Configuration.AuthorizationRule.IsUserAllowed(IPrincipal user, String verb) +354
   System.Web.Configuration.AuthorizationRuleCollection.IsUserAllowed(IPrincipal user, String verb) +245
   System.Web.Security.UrlAuthorizationModule.OnEnter(Object source, EventArgs eventArgs) +11153304
   System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +80
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +171

web.config 文件包含以下与身份验证/授权相关的信息:

<authentication mode="Windows" />
<authorization&gt
  <!--Deny anonymous users--&gt
  <deny users="?"/&gt
  <allow roles="domain\GroupWithAccess"/&gt
  <deny users="*"/&gt
</authorization&gt

我在研究此错误时发现的大多数结果都表明问题与域中的计算机帐户损坏有关,并将解决方案列为重新加入域。我已经这样做了,但错误仍然出现。 “正常”域操作工作正常(访问 UNC 共享、登录等)。

出于兼容性原因,此应用程序在 Classic .Net AppPool 中运行。我尝试将 AppPool 的标识更改为“NetworkService”,但错误仍然存​​在。

非常感谢任何帮助。

【问题讨论】:

    标签: asp.net iis windows-7 windows-authentication


    【解决方案1】:

    在 Windows Server 2008 R2 遇到同样的问题后,我终于找到了答案。来自this article

    在 Windows 2008 R2 服务器上禁用以下策略,运行 gpupdate /force 并重新启动服务器。

    “计算机配置\Windows 设置\安全设置\本地策略\安全选项”

    域成员:对安全通道数据进行数字加密或签名(始终)
    域成员:对安全通道数据进行数字加密(如果可能)
    域成员:对安全通道数据进行数字签名(如果可能)

    我可以确认这也解决了 Windows 7 上的问题。

    【讨论】:

    • 我无法控制 AD,我必须进行配置更改才能使其正常工作
    • 链接文章指向适用于 Server 2008 R2 RTM 的 KB976494。对于 SP1,该修复程序已包含在内。请参阅我对@jishi 答案的评论。不过,不确定这种解决方法在某些情况下是否仍然适用。
    【解决方案2】:

    我添加这个以供将来参考:

    “在运行 Windows 7 或 Windows Server 2008 R2 的计算机上使用 LookupAccountName 函数时出现错误 1789”

    http://support.microsoft.com/kb/976494

    这也可能是解决问题的方法。

    【讨论】:

    • 请注意,KB976494 包含在 Windows Server 2008 R2 的 SP1 中(因此无法再安装)。如果您运行的是 SP1,这不是您正在寻找的修复程序。请参阅support.microsoft.com/en-au/help/976932/…(不幸的是,请下载 SP 的 Excel 清单)
    猜你喜欢
    • 2012-09-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-01-26
    相关资源
    最近更新 更多