我们有一个 ASP.Net Web 应用程序,它的 App Pool 的标识是“网络服务”。在这个应用程序中,我们有一个设置页面;那里我们接受用户名。我们在针对 ADSI (Active Directory) 验证用户名时遇到以下异常。如果我们将应用程序池的身份从“网络服务”更改为我们的域帐户,那么我们就可以成功验证用户名。
在这里,我们不能使用我们的域帐户作为 App Pool 的身份。请提出任何替代方案来解决此问题。
Exception Information
*********************************************
Exception Type: System.DirectoryServices.DirectoryServicesCOMException
ExtendedError: -1073740781
ExtendedErrorMessage: C0000413: LdapErr: DSID-0C0904DC, comment: AcceptSecurityContext error, data 78f, v1db1
ErrorCode: -2147023570
Message: Logon failure: unknown user name or bad password.
Data: System.Collections.ListDictionaryInternal
TargetSite: Void Bind(Boolean)
HelpLink: NULL
Source: System.DirectoryServices
HResult: -2147023570
StackTrace Information
*********************************************
at System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail)
at System.DirectoryServices.DirectoryEntry.Bind()
at System.DirectoryServices.DirectoryEntry.get_AdsObject()
at System.DirectoryServices.DirectorySearcher.FindAll(Boolean findMoreThanOne)
at System.DirectoryServices.DirectorySearcher.FindOne()
at.-------UserSettings.IsValidUser(String userName)"