我们正在将我们的服务器和.net应用程序从Windows 2000升级到新购买的Windows 2012R2服务器。有一个功能在Windows 2000中有效,但在Windows 2012R2中不起作用。
我们正在使用Visual Studio professional 2015在Windows 2000和IIS 5.0中运行.net 2.0内部应用程序。此应用程序中有一个功能,它将使用LDAP对AD服务器进行函数调用以检查登录ID和密码在Active Directory中。之前运行得非常好。但是,一旦我升级到运行.net 2.0的新的window2012R2服务器,它就不起作用了。应用程序中的功能无法在Active Directory中获得授权。功能如下:
Private Function IsAuthenticatedByAD(ByVal sUid As String, ByVal sPwd As String) As Boolean
Dim direntRoot As DirectoryEntry, direntUsr As DirectoryEntry
Dim sDomain As String, sDomainAndUid As String
Dim dirsrchUsr As DirectorySearcher, oNative As Object
direntRoot = New DirectoryEntry("LDAP://rootDSE")
sDomain = direntRoot.Properties("DefaultNamingContext")(0)
sDomainAndUid = String.Format("{0}\{1}", sDomain, sUid)
direntUsr = New DirectoryEntry(direntRoot.Path, sDomainAndUid, sPwd)
Try
oNative = direntUsr.NativeObject
Catch ex As Exception
Return False
End Try
Return True
End Function
我在"尝试"中收到错误消息运行时的部分oNative = .... 错误消息如下:
" System.DirectoryServices.DirectoryServicesCOMException(0x8007052E): 用户名或密码不正确。" &安培; vbCrLf& vbCrLf& "在 System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail)" &安培; vbCrLf& "在System.DirectoryServices.DirectoryEntry.Bind()" &安培; vbCrLf& "在 System.DirectoryServices.DirectoryEntry.get_NativeObject()" &安培; vbCrLf& " at ums.business.UsrMgmtBus.IsAuthenticatedByAD(String sUid,String sPwd)在C:\ inetpub \ wwwroot \ ums \ business \ UsrMgmtBus.vb:第127行"
请帮忙。非常感谢。