System.Web.Security.Roles.GetRolesForUser(HttpContext.Current.Request.LogonUserIdentity.Name)
但是看看elmah日志,我们发现这部分请求并非意外失败
内部堆栈跟踪
System.Configuration.Provider.ProviderException: Unable to query Active Directory. ---> System.DirectoryServices.ActiveDirectory.ActiveDirectoryServerDownException: The remote procedure call failed.
at System.DirectoryServices.ActiveDirectory.Utils.GetDSHandle(String domainControllerName, String domainName, IntPtr authIdentity, LoadLibrarySafeHandle libHandle)
at System.DirectoryServices.ActiveDirectory.DomainController.GetDSHandle()
at System.DirectoryServices.ActiveDirectory.DomainController.GetDomainControllerInfo()
at System.DirectoryServices.ActiveDirectory.DomainController.get_SiteName()
at System.DirectoryServices.AccountManagement.ADStoreCtx.GetGroupsMemberOf(Principal p)
at System.DirectoryServices.AccountManagement.Principal.GetGroupsHelper()
at App.AppRoleProvider.GetRolesForUser(String username)