MVC app gives exception when communicating with MS 2008 Domain Controller to get user password

0

I have an MVC application that just recently started failing on my production IIS 7.5 server during an operation that retreives the users password information. The same application running on a development IIS Server or on my personal computer with localhost is able to communicate with the domain controller as usual. I have not rebooted the production server yet but we have server maintenance coming up next weekend and I will reboot then. I'm hoping to find the cause before then in case the reboot resolves the issue. I don't really know where to begin troubleshooting.

Edit: 8/13/2012 The problem has become intermittant and I am including code and the exception verbage

Here is the code taht I use to get the users password info:

 public int GetPasswordExpiration(string user)
    {

        PrincipalContext ctx = new PrincipalContext(ContextType.Domain);
        UserPrincipal currLogin = UserPrincipal.FindByIdentity(ctx, user);
        DateTime passwordLastSet = currLogin.LastPasswordSet.Value;
        int doyPasswordSet = passwordLastSet.DayOfYear;
        int doy = DateTime.Today.DayOfYear;
        int daysSinceLastset = (doy - doyPasswordSet);
        int daysTilDue = (120 - daysSinceLastset);
        return (daysTilDue);

    }

Here is the exception:

Unknown error (0x80005000) Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Runtime.InteropServices.COMException: Unknown error (0x80005000)

[COMException (0x80005000): Unknown error (0x80005000)]
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 entry, String
propertyName) +119
System.DirectoryServices.PropertyCollection.get_Item(String propertyName) +163
System.DirectoryServices.AccountManagement.PrincipalContext.DoLDAPDirectoryInitNoContainer() +436
System.DirectoryServices.AccountManagement.PrincipalContext.DoDomainInit() +51
System.DirectoryServices.AccountManagement.PrincipalContext.Initialize() +141
System.DirectoryServices.AccountManagement.PrincipalContext.get_QueryCtx() +42
System.DirectoryServices.AccountManagement.Principal.FindByIdentityWithTypeHelper
(PrincipalContext context, Type principalType, Nullable`1 identityType, String identityValue,
DateTime refDate) +27
System.DirectoryServices.AccountManagement.UserPrincipal.FindByIdentity(PrincipalContext
context, String identityValue) +95
ArctecLogisticsWebFiles.Utilities.CommonFunctions.GetPasswordExpiration(String user) +212
ArctecLogisticsWebFiles.Controllers.LoginDisplayController._GetFriendlyName() +585
lambda_method(Closure , ControllerBase , Object[] ) +81
System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext 
controllerContext,              IDictionary`2 parameters) +264
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext
controllerContext,     ActionDescriptor actionDescriptor, IDictionary`2 parameters) +39
System.Web.Mvc.<>c__DisplayClass15.<InvokeActionMethodWithFilters>b__12() +129
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter,
ActionExecutingContext preContext, Func`1 continuation) +826266
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(ControllerContext
controllerContext, IList`1 filters, ActionDescriptor actionDescriptor, IDictionary`2 parameters)
+314
System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String
actionName) +825488
System.Web.Mvc.Controller.ExecuteCore() +159
System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +335
System.Web.Mvc.<>c__DisplayClassb.<BeginProcessRequest>b__5() +62
System.Web.Mvc.Async.<>c__DisplayClass1.<MakeVoidDelegate>b__0() +20
System.Web.Mvc.<>c__DisplayClasse.<EndProcessRequest>b__d() +54
System.Web.Mvc.<>c__DisplayClass4.<Wrap>b__3() +15
System.Web.Mvc.ServerExecuteHttpHandlerWrapper.Wrap(Func`1 func) +41
System.Web.HttpServerUtility.ExecuteInternal(IHttpHandler handler, TextWriter writer, 
Boolean      preserveForm, Boolean setPreviousPage, VirtualPath path, VirtualPath filePath,
String physPath,     
Exception error, String queryStringOverride) +1443
[HttpException (0x80004005): Error executing child request for
handler 'System.Web.Mvc.HttpHandlerUtil+ServerExecuteHttpHandlerAsyncWrapper'.]
System.Web.HttpServerUtility.ExecuteInternal(IHttpHandler handler, TextWriter writer,
Boolean     
System.Web.Mvc.Html.ChildActionExtensions.ActionHelper(HtmlHelper htmlHelper, String
actionName, String controllerName, RouteValueDictionary routeValues, TextWriter textWriter) +834
System.Web.Mvc.Html.ChildActionExtensions.RenderAction(HtmlHelper htmlHelper, String
actionName,   String controllerName, RouteValueDictionary routeValues) +56
ASP._Page_Views_Shared__Layout_cshtml.Execute() +1973
System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +280
System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +104
System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter
writer, WebPageRenderingBase startPage) +173
System.Web.WebPages.WebPageBase.Write(HelperResult result) +89
System.Web.WebPages.WebPageBase.RenderSurrounding(String partialViewName, Action`1 body) +234
System.Web.WebPages.WebPageBase.PopContext() +222
System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context) +384
System.Web.Mvc.<>c__DisplayClass1c.<InvokeActionResultWithFilters>b__19() +33
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter,  ResultExecutingContext preContext, Func`1 continuation) +825460
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult) +265
System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +825488
System.Web.Mvc.Controller.ExecuteCore() +159
System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +335
System.Web.Mvc.<>c__DisplayClassb.<BeginProcessRequest>b__5() +62
System.Web.Mvc.Async.<>c__DisplayClass1.<MakeVoidDelegate>b__0() +20
System.Web.Mvc.<>c__DisplayClasse.<EndProcessRequest>b__d() +54
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +469
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +375
windows
iis
iis-7.5
asked on Stack Overflow Aug 11, 2012 by Alan Fisher • edited Aug 13, 2012 by Alan Fisher

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0