title: Not able to fetch users from the OU
body: <p>I'm working on a project where I have to fetch the users from a particular OU in Active Directory.</p>
  
  <p>I use the <code>Dropdown</code> menu to store all the OUs present. As soon as the user selects a particular OU and clicks on the button the users available for that should be displayed in the textbox.</p>
  
  <p>This is the code being used:</p>
  
  <pre><code>public MainWindow()
      {
          InitializeComponent();
          DirectoryEntry rootDSE = new DirectoryEntry("LDAP://RootDSE");
          string defaultContext = rootDSE.Properties["defaultNamingContext"][0].ToString();
          DirectoryEntry domainRoot = new DirectoryEntry("LDAP://" + defaultContext);
          DirectorySearcher ouSearcher = new DirectorySearcher(domainRoot);
          ouSearcher.SearchScope = SearchScope.Subtree;
          ouSearcher.PropertiesToLoad.Add("ou");
          ouSearcher.PropertiesToLoad.Add("cn");
          ouSearcher.SearchScope = SearchScope.Subtree;
          ouSearcher.Filter = "(objectCategory=organizationalUnit)";
  
          try
          {
              comboBox1.SelectedIndex = 0;
              comboBox1.Items.Insert(0, "Select An OU");
              string ouName;
              foreach (SearchResult deResult in ouSearcher.FindAll())
              {
                  ArrayList alObjects = new ArrayList();
                  ouName = deResult.Properties["ou"][0].ToString();
                  comboBox1.Items.Insert(1, ouName.ToString());
              }          
          }
          catch (Exception ex2)
          {
          }
      }
  
  private void button1_Click(object sender, RoutedEventArgs e) //Error is present in this part
      {
          string selectou = comboBox1.SelectedValue.ToString();
          DirectoryEntry rootDSE = new DirectoryEntry("LDAP://" + selectou);
          string defaultContext = rootDSE.Properties["defaultNamingContext"][0].ToString(); //Here is the problem
          DirectoryEntry domainRoot = new DirectoryEntry("LDAP://" + selectou);
          DirectorySearcher ouSearcher = new DirectorySearcher(selectou);
          ouSearcher.SearchScope = SearchScope.Subtree;
          ouSearcher.PropertiesToLoad.Add("cn");
          ouSearcher.SearchScope = SearchScope.Subtree;
          ouSearcher.Filter = "(&amp;(objectClass=user)(objectCategory=person))";
          foreach (SearchResult deResult in ouSearcher.FindAll())
          {
              ArrayList alObjects = new ArrayList();
              string dcName = deResult.Properties["cn"][0].ToString();
              textBox1.Text = textBox1.Text + dcName.ToString() + "\n";
          }
      }
  </code></pre>
  
  <p>Now the problem is occuring at button1_click function. For defaultcontext it throws the following error:</p>
  
  <p><code>System.Runtime.InteropServices.COMException: The server is not operational.</code></p>
  
  <p>I'm not able to figure out how to go about this error. Am I missing some kind of assemblies?</p>