请考虑此代码尝试创建Active Directory帐户。它在这里使用一组数据生成异常。目前尚不清楚导致异常的原因。
var user = new UserPrincipal(someValidUserContext,
".x-xyz-t-FooFooBarTest", "somePwd", true);
user.UserPrincipalName = "[email protected]";
user.SamAccountName = ".x-xyz-t-FooFooBarTest";
user.DisplayName = "Some String 16 chars long";
user.Name = "Some String 16 chars long";
user.Description = "Foo BarBaz 12 more characters";
user.AccountExpirationDate = someDateInFuture;
user.UserCannotChangePassword = true;
user.Save();
// exception thrown on Save():
// A device attached to the system is not functioning
用户代码未处理PrincipalOperationException:连接到系统的设备无法运行
造成这种异常的原因是什么,你如何解决这个问题?
sAMAccountName属性必须为20个字符或更少。