对System.DirectoryServices.DirectoryServicesCOMException: An operations error occurred的副本表示歉意,但我无法发表评论且没有答案。
这个问题的解决方案没有用。 Error on publishing: System.DirectoryServices.DirectoryServicesCOMException
我在Visual Studio 2010中有一个带有Razor视图引擎的新ASP.NET MVC 3 Web应用程序项目。它是通过添加两行代码添加到家庭控制器和System.DirectoryServices.AccountManagement
生成的。引用已添加到项目中。
这在我的本地PC上运行得很好,但是我在我创建的Windows 2008 R2 IIS 7.5网站上收到错误。
该网站使用的是使用defaultAppPool
的{{1}}。根站点文件夹已被授予ApplicationPoolIdentity
和IUSR
读取权限。
控制器中的两行代码是:
IIS AppPool\DefaultAppPool
我得到的错误是:
System.DirectoryServices.DirectoryServicesCOMException:发生操作错误。
堆栈追踪:
[DirectoryServicesCOMException(0x80072020):发生操作错误。]
System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail)+781
System.DirectoryServices.DirectoryEntry.Bind()+44
System.DirectoryServices.DirectoryEntry.get_AdsObject()+42
System.DirectoryServices.PropertyValueCollection.PopulateList()+29
System.DirectoryServices.PropertyValueCollection..ctor(DirectoryEntry条目,String propertyName)+119
System.DirectoryServices.PropertyCollection.get_Item(String propertyName)+163
System.DirectoryServices.AccountManagement.PrincipalContext.DoLDAPDirectoryInitNoContainer() 535649
System.DirectoryServices.AccountManagement.PrincipalContext.DoDomainInit()+51
System.DirectoryServices.AccountManagement.PrincipalContext.Initialize()+ 1411 System.DirectoryServices.AccountManagement.PrincipalContext.get_QueryCtx()+42
System.DirectoryServices.AccountManagement.Principal.FindByIdentityWithTypeHelper(PrincipalContext context,Type principalType,NullablePrincipalContext context = new PrincipalContext(ContextType.Domain); ViewBag.name = UserPrincipal.FindByIdentity(context, User.Identity.Name).DisplayName;
2个参数)+248
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext,ActionDescriptor actionDescriptor,IDictionary1 identityType, String identityValue, DateTime refDate) +27
1 continuation)+640
System.DirectoryServices.AccountManagement.UserPrincipal.FindByIdentity(PrincipalContext context, String identityValue) +95
ActiveDirectory.Controllers.HomeController.Index() in C:\projects\ActiveDirectory\ActiveDirectory\Controllers\HomeController.cs:18
lambda_method(Closure , ControllerBase , Object[] ) +79
System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(ControllerContext controllerContext,IList2 parameters) +39
2个参数)+312
System.Web.Mvc.<>c__DisplayClass15.<InvokeActionMethodWithFilters>b__12() +125
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func
System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext,String actionName)+691
System.Web.Mvc.Controller.ExecuteCore()+162
System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext)+305
System.Web.Mvc。&lt;&gt; c__DisplayClassb.b__5()+62
System.Web.Mvc.Async。&lt;&gt; c__DisplayClass1.b__0()+ 20
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() 469
System.Web.HttpApplication.ExecuteStep(IExecutionStep step,Boolean&amp; completedSynchronously)+375
很好,这是我的第一个问题!
答案 0 :(得分:4)
这很可能是权限问题。检查运行App Pool的帐户是否有权执行这些Active Directory调用。如果它是本地计算机帐户,则可能会赢得
。您可以在此处找到更多信息:http://msdn.microsoft.com/en-US/library/ms180891(v=vs.80).aspx