0

尝试登录我的应用程序时收到以下错误。它在本地工作,但在使用远程服务器时收到此错误。

错误

The format of the specified domain name is invalid.
System.DirectoryServices.ActiveDirectory.ActiveDirectoryOperationException: The format of the specified domain name is invalid.

堆栈跟踪

[ActiveDirectoryOperationException: The format of the specified domain name is invalid.]
System.DirectoryServices.ActiveDirectory.DirectoryContext.GetDnsDomainName(String domainName) +195
System.DirectoryServices.ActiveDirectory.DirectoryContext.GetLoggedOnDomain() +785
System.DirectoryServices.ActiveDirectory.DirectoryContext.IsContextValid(DirectoryContext context, DirectoryContextType contextType) +186
System.DirectoryServices.ActiveDirectory.DirectoryContext.isDomain() +66
System.DirectoryServices.ActiveDirectory.Domain.GetDomain(DirectoryContext context) +98
PQI.ActiveDirectoryPasswordExpires..ctor() in [PATH REMOVED]\vb\ActiveDirectoryPasswordExpires.vb:11
PQI._Default.UserIsSuper(String username, String password) in [PATH REMOVED]\Default.aspx.vb:104
PQI._Default.rb_Login_Click(Object sender, EventArgs e) in [PATH REMOVED]\Default.aspx.vb:20
Telerik.Web.UI.RadButton.RaisePostBackEvent(String eventArgument) +311
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3707

这是一个标准的 VB.Net 应用程序,没有什么特别之处,只是检查 AD 以验证登录用户(正如堆栈跟踪所暗示的,超级用户是否属于特定的 AD 组)。有没有人遇到过这个问题?我究竟做错了什么?

暂存服务器上的应用程序位于其自己的 .Net 4.0/Integrated 应用程序池中。

为了回答 Matt Wilko 的问题,LDAP 字符串是动态生成的。下面 New() 函数的第一行是触发错误的原因。

Public Sub New()
    Dim currentDomain As Domain = Domain.GetCurrentDomain
    Dim root As DirectoryEntry = currentDomain.GetDirectoryEntry
    Using (currentDomain)
        Using (root)
            Me.policy = New ActiveDirectoryDomainPolicy(root)
        End Using
    End Using
End Sub
4

0 回答 0