我有同样的web应用程序在其他三个服务器的工作。 任何人有,为什么没有在第四服务器工作的任何想法? 请参阅错误和堆栈跟踪:
发生操作错误。
说明:在当前Web请求的执行过程中发生未处理的异常。 请检查堆栈跟踪有关该错误它起源于代码的详细信息和。
异常详细信息:
System.DirectoryServices.DirectoryServicesCOMException:出现操作错误。源错误:
在当前web请求的执行过程中生成未处理的异常。 有关异常原因和发生位置的信息可以使用异常堆栈跟踪下面来识别。
堆栈跟踪:
[DirectoryServicesCOMException(0x80072020):出现操作错误。 ] System.DirectoryServices.DirectoryEntry.Bind(布尔throwIfFail)454 System.DirectoryServices.DirectoryEntry.Bind()36 System.DirectoryServices.DirectoryEntry.get_AdsObject()31 System.DirectoryServices.PropertyValueCollection.PopulateList()22
System.DirectoryServices.PropertyValueCollection..ctor(的DirectoryEntry条目,弦乐propertyName的)+96
System.DirectoryServices.PropertyCollection.get_Item(字符串propertyName的)142 System.DirectoryServices.AccountManagement.PrincipalContext.DoLDAPDirectoryInitNoContainer()1134 System.DirectoryServices.AccountManagement.PrincipalContext.DoDomainInit()37 System.DirectoryServices.AccountManagement.PrincipalContext.Initialize() 124 System.DirectoryServices.AccountManagement.PrincipalContext.get_QueryCtx()31 System.DirectoryServices.AccountManagement.Principal.FindByIdentityWithTypeHelper(PrincipalContext上下文中,类型principalType,Nullable'1 identityType,字符串identityValue,日期时间refDate)14
System.DirectoryServices.AccountManagement.Principal.FindByIdentityWithType(PrincipalContext背景下,类型principalType,字符串identityValue)+73
System.DirectoryServices.AccountManagement.UserPrincipal.FindByIdentity(PrincipalContext上下文,字符串identityValue)25
Infraero.TINE3.STTEnterprise.Web.Common.Seguranca.ServicoAutenticacao.EfetuarLogin(AcessoUsuario acessoUsuario,字符串senha)在d:\ SVN \ STT \树干\ 4-0_CodigoFonte_Enterprise \ 4-4_SRC \ Infraero.TINE3.STTEnterprise.Web \共同\ Seguranca \ ServicoAutenticacao.cs:34 Infraero.TINE3.STTEnterprise.Web.Controllers.LoginController.ValidarUsuarioAD(字符串matricula,字符串senha,AcessoUsuario acessoUsuario)在d:\ SVN \ STT \树干\ 4-0_CodigoFonte_Enterprise \ 4-4_SRC \ INFRAERO。 TINE3.STTEnterprise.Web \控制器\ LoginController.cs:92 Infraero.TINE3.STTEnterprise.Web.Controllers.LoginController.ValidarUsuario(字符串matricula,字符串senha)在d:\ SVN \ STT \树干\ 4-0_CodigoFonte_Enterprise \ 4-4_SRC \ Infraero.TINE3.STTEnterprise.Web \控制器\ LoginController.cs:80 Infraero.TINE3.STTEnterprise.Web.Controllers.LoginController.Index(loginViewModel loginViewModel)在d:\ SVN \ STT \树干\ 4-0_CodigoFonte_Enterprise \ 4-4_SRC \ Infraero.TINE3.STTEnterprise.Web \ \控制器LoginController.cs:54 lambda_method(封闭,控制研究 erBase,对象[])108
System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase控制器,对象[]参数)17
System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext,IDictionary'2参数)208
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext,ActionDescriptor actionDescriptor,IDictionary'2参数)27
System.Web.Mvc。<> c__DisplayClass15.b__12()55 System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter滤波器,ActionExecutingContext preContext,Func'1续)263
System.Web.Mvc。<> c__DisplayClass17.b__14()19个System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(ControllerContext controllerContext,IList'1滤波器,ActionDescriptor actionDescriptor,IDictionary`2参数)191
System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext,字符串actionName)343
System.Web.Mvc.Controller.ExecuteCore()+116
System.Web.Mvc.ControllerBase.Execute(RequestContext的RequestContext的)+97 System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext的RequestContext的)+10
System.Web.Mvc。<> c__DisplayClassb.b__5()37
System.Web.Mvc.Async。<> c__DisplayClass1.b__0()21
System.Web.Mvc.Async。<> c__DisplayClass8'1.b__7(IAsyncResult的_)12 System.Web.Mvc.Async.WrappedAsyncResult'1.End()62 System.Web.Mvc。<> c__DisplayClasse.b__d( )+50
System.Web.Mvc.SecurityUtil.b__0(动作F)+7 System.Web.Mvc.SecurityUtil.ProcessInApplicationTrust(动作动作)+22 System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult的asyncResult)+60
System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult的结果)+9
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()8963149 System.Web.HttpApplication.ExecuteStep(IExecutionStep步骤,布尔逻辑completedSynchronously)184
EfetuarLogin方法:
public static bool EfetuarLogin(User user, string password)
{
bool isValid = false;
if (user != null)
{
PrincipalContext context = new PrincipalContext(ContextType.Domain);
using (context)
{
isValid = context.ValidateCredentials(user.Login, password);
if (isValid)
{
UserPrincipal userAD = UserPrincipal.FindByIdentity(context, user.Login);
MySession.CurrentUser = new MyUserSession()
{
Id = user.Id,
ProfileId = user.ProfileId ,
Login = user.Login ,
Name = userAD.Name
};
}
}
}
return isValid;
}