IIS application pool Monitoring method Instance _win server

Source: Internet
Author: User
Tags system log

Purpose: Company Server IIS has more than 10 application address pools, always inadvertently stopped a, stop line system log will have a lot of warning log, and then stopped, analyzed several times, online some people say that is a certain site should check the site, but the site has so many addresses, Who knows from which request to start the application of the address pool to get hung up ah, the day is okay at any time someone looked at the server in the evening stopped on the trouble, all have the demand, automatic monitoring application address pool. In fact, the method is very simple, is timed to the application of the address pool traversal, check whether there is an open application address pool, and then execute the start command.

Copy Code code as follows:

<summary>
IIS application address Pool monitoring method
</summary>
private void Iisapppools ()
{
Try
{
String Entpath = "Iis://localhost/w3svc/apppools";
while (true)
{
DirectoryEntry rootentry = new DirectoryEntry (Entpath);
foreach (DirectoryEntry AppPool in Rootentry.children)
{
if (apppool.properties["AppPoolState"]. Value.tostring ()!= "2")
{
Loghelper.wirte ("Monitor to" + Apppool.name + "Apply address pool stop.");
Apppool.invoke ("Start", null);
Apppool.commitchanges ();
Loghelper.wirte (Apppool.name + "Apply address pool started successfully.");
}
Apppool.close ();
}
Thread.Sleep (600000);
}
}
catch (Exception ex)
{
Loghelper.wirte (ex. ToString ());
}
}

This one method is done, 10 minutes monitoring, no system resources.

But how do we get it? The collection of address pools in IIS is actually a special address, and any configuration in IIS is available

Recommend a visualization tool, IIS resource management tools, we can Baidu.

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.