Ad exception: the server is unwilling to process the request. (Exception from hresult: 0 × 80072035)

Source: Internet
Author: User
Tags samaccountname
You need to use the ad operation and find an adhelper on the Internet. Code Run the following command to adhelper. enableuser (CommonName ,: Directoryentry entry = Getdirectoryobject ();

Directoryentry subentry = Entry. Children. Find (ldapdn );

Directoryentry deuser = Subentry. Children. Add ( " CN = "   + CommonName, " User " );

Deuser. properties [ " Samaccountname " ]. Value = Samaccountname;

Deuser. commitchanges ();

Adhelper. enableuser (CommonName );

Adhelper. setpassword (CommonName, password );

Deuser. Close ();

Return Deuser;

Exception: the server is unwilling to process the request. (The exception comes from hresult: 0x80072035). Haha, it's quite user-friendly, so I don't want

System. directoryservices. directoryservicescomexception was unhandled
Message = " The server is unwilling to process the request. (Exception from hresult: 0x80072035) "
Source = " System. directoryservices "
Errorcode =- 2147016651
Extendederror = 1325
Extendederrormessage = " 0000052d: svcerr: DSID-031A0FC0, problem 5003 (will_not_perform), DATA 0 \ n "
Stacktrace:
In system. directoryservices. directoryentry. commitchanges ()
In leleapplication3.adhelper. enableuser (directoryentry de) Location E: \ Visual Studio 2005 \ Projects \ leleapplication3 \ consoleapplication3 \ adhelper. CS: row number 1168
In leleapplication3.adhelper. enableuser (string CommonName) Location E: \ Visual Studio 2005 \ Projects \ leleapplication3 \ consoleapplication3 \ adhelper. CS: row number 1146
At leleapplication3.adhelper. createnewuser (string ldapdn, string CommonName, string samaccountname, string password) Location E: \ Visual Studio 2005 \ Projects \ leleapplication3 \ consoleapplication3 \ adhelper. CS: row number 812
In leleapplication3.adhelper. createnewuser (string CommonName, string samaccountname, string password) Location E: \ Visual Studio 2005 \ Projects \ leleapplication3 \ consoleapplication3 \ adhelper. CS: row number 842
In leleapplication3.program. Main (string [] ARGs) Location E: \ Visual Studio 2005 \ Projects \ leleapplication3 \ consoleapplication3 \ Program. CS: row number 21
In system. appdomain. nexecuteassembly (Assembly, string [] ARGs)
In Microsoft. visualstudio. hostingprocess. hostproc. runusersassembly ()
In system. Threading. executioncontext. Run (executioncontext, contextcallback callback, object state)
In system. Threading. threadhelper. threadstart ()

After searching for a long time, I cannot figure out the cause. Finally, I put adhelper. setpassword (CommonName, password); In Front Of adhelper. enableuser (CommonName,ProgramYou can pass it. Haha, speechless.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.