[英]Setting Active Directory User Password Error (RPC-Server is unavailable)
I'm creating an ASP.NET Web Application which should set a password on an event. 我正在创建一个ASP.NET Web应用程序,该应用程序应在事件中设置密码。 Now I always get the error "RPC-Server is unavailable. (Exception HRESULT: 0x800706BA)" 现在,我总是收到错误“ RPC服务器不可用。(异常HRESULT:0x800706BA)”
PrincipalContext context = new PrincipalContext(ContextType.Domain, "FOOBAR.LOC", @"FOOBAR\Administrator", "password");
UserPrincipal principal = UserPrincipal.FindByIdentity(context, "myuser");
principal.SetPassword("newpassword");
I searched the whole internet for a solution but couldn't find any. 我在整个互联网上搜索了一个解决方案,但找不到任何解决方案。
Cheers 干杯
第一个结果: http : //support.microsoft.com/kb/935677
Use the DirectoryEntry object to set the password : 使用DirectoryEntry对象设置密码:
using (var user = new DirectoryEntry("LDAP://<IP/name>/CN=dummy,DC=corp",
"<admin>",
"<admin pass>"))
{
user.Invoke("SetPassword", new object[] { "password" });
user.CommitChanges();
}
As explained in this answer : https://stackoverflow.com/a/4895603/971 如此答案中所述: https : //stackoverflow.com/a/4895603/971
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.