C# LDAP异常对象类冲突:添加新用户
我试图在LDAP目录中创建一个用户,但出现以下错误:“对象类冲突”。有人能提出解决办法吗C# LDAP异常对象类冲突:添加新用户,c#,c#-4.0,ldap,C#,C# 4.0,Ldap,我试图在LDAP目录中创建一个用户,但出现以下错误:“对象类冲突”。有人能提出解决办法吗 try { DirectoryEntry ouEntry = new DirectoryEntry("LDAP://localhost:389/ou=people,dc=wso2,dc=com","cn=admin,dc=wso2,dc=com", "toto", AuthenticationTypes.Secure); DirectoryEntry childE
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);
}
我解决它
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);
}
Anglais,s'il vous plait..您确定您使用的管理帐户具有创建用户的适当权限吗?我相信您还需要为新用户和组至少设置
samAccountName
,并且它必须是唯一值(在您的域容器中是唯一的)我使用管理帐户。我还尝试设置samAccountName,但出现以下错误:“属性类型未定义”,并且总是出现此错误:“LdapException:匹配的DN:”