C # Remote Recycle IIS application pool

Source: Internet
Author: User

Use the following code to implement remote collection of IIS application pools

var servermanager = servermanager.openremote (IP); var apppools = servermanager.applicationpools; foreach (var in apppools) {ap. Recycle ();}

Note the point:

1. Need to add reference C:\Windows\System32\inetsrv\Microsoft.Web.Administration.dll, then using Microsoft.Web.Administration;

2. Remote account requires administrator privileges;

3. The account password of the remote host is added in the Credential manager of the server (Control Panel, credential Manager), can be successfully used MSTSC login;

4. Remote host needs to shut down uac!! It's been a matter of weeks before I accidentally discovered it.

PS: The AP can be used. The return value of Recycle () determines whether the collection was successful.

C # Remote Recycle IIS application pool

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.