Boon Chye Phang
asked on
Received "The server cannot handle directory requests" exception message when trying to create Active Directory user account
When trying to create Active Directory user account using .Net code, received an exception that says:
Here is the source code:
The solution online (https://stackoverflow.com/questions/3694919/nets-directory-services-throws-a-strange-exception) does not seems to be applicable because the IIS website is accessible from network, and used to be able to create user account.
Also tried adding port number (server:636) but it cannot reach the server.
Need help to identify what is the issue and to solve this.
The server cannot handle directory requests.
Here is the source code:
The solution online (https://stackoverflow.com/questions/3694919/nets-directory-services-throws-a-strange-exception) does not seems to be applicable because the IIS website is accessible from network, and used to be able to create user account.
Also tried adding port number (server:636) but it cannot reach the server.
Need help to identify what is the issue and to solve this.
ASKER
Hi Shaun,
Is there an example of using System.DirectoryServices.A ccountMana gement?
Is there an example of using System.DirectoryServices.A
using(var pc = new PrincipalContext(ContextType.Domain))
{
using(var up = new UserPrincipal(pc))
{
up.SamAccountName = username;
up.EmailAddress = email;
up.SetPassword(password);
up.Enabled = true;
up.ExpirePasswordNow();
up.Save();
}
}
https://stackoverflow.com/questions/2305857/creating-active-directory-user-with-password-in-c-sharp?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
It may have different scenarios having such message, but my case is due to password does not fit the AD server specified requirement
Try using System.DirectoryServices.A