【问题标题】:creating a user in Active Directory: A device attached to the system is not functioning在 Active Directory 中创建用户:连接到系统的设备无法运行
【发布时间】:2011-03-06 22:45:09
【问题描述】:

考虑此代码尝试创建 Active Directory 帐户。它在这里使用一组数据生成异常。目前尚不清楚是什么导致了异常。

 var user = new UserPrincipal(someValidUserContext,
                              ".x-xyz-t-FooFooBarTest", "somePwd", true);

 user.UserPrincipalName = ".x-xyz-t-FooFooBarTest@foobarbatbaz.net";
 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 未被用户代码处理: 连接到系统的设备无法正常工作

是什么导致了这个异常,你如何解决它?

【问题讨论】:

    标签: c# active-directory asp.net-3.5


    【解决方案1】:

    sAMAccountName 属性不得超过 20 个字符。

    【讨论】:

    • Microsoft 可能显示的另一条消息:您刚刚遇到错误。敬上。微软。
    • 这是我刚刚发现的一篇关于这个问题的非常富有诗意的文章:usrlocal.com/2009/08/… 再次......有点讽刺:)
    • 6 年下来,同样的血腥错误信息。我是否在想“对于这样的通用错误消息,谷歌肯定是没用的”。是的,20 个字符仍然是限制和问题解决者!
    • msdn.microsoft.com/en-us/library/… SAM-Account-Name 属性
    猜你喜欢
    • 2018-06-13
    • 2015-03-14
    • 1970-01-01
    • 2021-08-15
    • 2012-08-18
    • 2012-06-05
    • 1970-01-01
    • 2020-12-14
    • 1970-01-01
    相关资源
    最近更新 更多