我正在尝试在LDAP目录中创建用户,但是我收到以下错误:“Object Class Violation”。有人可以提出解决方案吗?
try
{
DirectoryEntry ouEntry = new DirectoryEntry("LDAP://localhost:389/ou=people,dc=wso2,dc=com","cn=admin,dc=wso2,dc=com", "toto", AuthenticationTypes.Secure);
DirectoryEntry childEntry = ouEntry.Children.Add("CN=tati toto", "inetOrgPerson");
childEntry.Properties["sn"].Add("toto");
childEntry.CommitChanges();
}
catch(Exception Ex)
{
Console.WriteLine("Exception : "+ Ex.Message);
}
答案 0 :(得分:0)
我解决了,
try
{
DirectoryEntry ouEntry = new DirectoryEntry("LDAP://localhost:389/ou=people,dc=wso2,dc=com","cn=admin,dc=wso2,dc=com", "toto", AuthenticationTypes.Secure);
DirectoryEntry childEntry = ouEntry.Children.Add("CN=tati toto", "top");
childEntry.Properties["objectclass"].Add("person");
childEntry.Properties["sn"].Add("toto");
childEntry.CommitChanges();
}
catch(Exception Ex)
{
Console.WriteLine("Exception : "+ Ex.Message);
}