The distinguished name contains invalid syntax while adding an object.

Mar 29, 2012 at 7:08 PM

I have a pretty simple map:


    DistinguishedName(x => x.DistingushedName);
    Map(x => x.Id).Named("objectguid").StoreGenerated();
    Map(x => x.CommonName).Named("cn");

    Map(x => x.FirstName).Named("givenName");
    Map(x => x.LastName).Named("sn");
    Map(x => x.PhoneNumber).Named("telephoneNumber");
    Map(x => x.EmailAddress).Named("mail");

When I try to add a new object it throws an exception from the underlying LDAP APIs with "The distinguished name contains invalid syntax.".  Anyone seen this before or have ideas on how to troubleshoot?  I'm able to add the object through LDP.EXE with the same set of attributes and values.

Mar 30, 2012 at 1:14 AM

I ended up removing the mapping for common name and it worked out fine.  Not sure what the issue was as the value for Common Name was set to "CN={FirstName} {LastName}".

Mar 30, 2012 at 3:09 AM

CN and OU attributes should be marked as ReadOnly or StoreGenerated.  It's a tricky attribute since you want to be able to query on it, but you can't update them directly since they make up a portion of the distinguished name.