IIS 7 Change DefaultAppPool to Network Service for this error ‘System.DirectoryServices.DirectoryServicesCOMException’

You may need to do this when your running you web component WCF service or whatever and you receive unusual errors likeSystem.DirectoryServices.DirectoryServicesCOMException’ when using directory services.


This is due to the fact that by default IIS7 runs as ‘IIS APPPOOL\\DefaultAppPool’  and doesn’t have enough permission. Change to Network service and it should be fine!



Quite simple to do it, just in case your more used to IIS6 🙂


1.     Start->Run-> Type 'inetmgr'

2.     Expand the server name on the left connections panel and you will see Application Pools

3.     Click ‘DefaultAppPool’

4.     Click ‘Advanced Settings’

5.     Goto ‘Process Model’ Section

6.     Select 'Identity'  = 'Network Service'


Hope that helps!






Comments (2)

  1. abc says:

    Thanks!! But I am getting new error now.

    Server Error in '/' Application.


    The (&(objectclass=user)(sAMAccountName=)) search filter is invalid.

    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.ArgumentException: The (&(objectclass=user)(sAMAccountName=)) search filter is invalid.

    Source Error:

    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.  

    Stack Trace:

    [ArgumentException: The (&(objectclass=user)(sAMAccountName=)) search filter is invalid.]

      MasterPage_GlobalElements.Page_Init() +371

      System.Web.Util.CalliHelper.ArglessFunctionCaller(IntPtr fp, Object o) +8

      System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +8836567

      System.Web.UI.Control.OnInit(EventArgs e) +91

      System.Web.UI.UserControl.OnInit(EventArgs e) +83

      System.Web.UI.Control.InitRecursive(Control namingContainer) +140

      System.Web.UI.Control.InitRecursive(Control namingContainer) +311

      System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +480

  2. Viktor Einarsson says:

    Thanks man, was just looking for how to change the DefaultAppPool .NET version, but this helped, thanks!

Skip to main content