When invoking SetPassword i receive the error: “Exception has been thrown by the target of an invocation.”

1

the set password is failed in the server.

Exception.message: Exception has been thrown by the target of an invocation at System.DirectoryServices.DirectoryEntry.Invoke(String methodName, Object[] args)

Why then will this call work from a local (developer) machine, but not work from a server?

     `      DirectoryEntry entry = new DirectoryEntry(..);
            entry.AuthenticationType = AuthenticationTypes.Secure;
            DirectorySearcher search = new DirectorySearcher(entry);
            search.Filter = "(&(sAMAccountName=" + userName_ + "))";
            DirectoryEntry userEntry = search.FindAll()[0].GetDirectoryEntry();
            userEntry.Invoke("SetPassword", new object[] {password@12345#"
            userEntry.CommitChanges();`

EDIT : InnerException is {"The RPC server is unavailable. (Exception from HRESULT: 0x800706BA)"}

c#
active-directory
asked on Stack Overflow Oct 27, 2013 by Emre Yardımcı • edited Nov 21, 2013 by Emre Yardımcı

1 Answer

0

Does the app run under the same account in both environments? If not, then per your question, it may be a permissions issue

answered on Stack Overflow Oct 28, 2013 by Stinky Towel

User contributions licensed under CC BY-SA 3.0