Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/csharp-4.0/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# LDAP异常对象类冲突:添加新用户_C#_C# 4.0_Ldap - Fatal编程技术网

C# 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

我试图在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 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:”