Application pool configuration in IIS

Source: Internet
Author: User

Iis6.0 and later versions, view IIS attributes

Http://msdn.microsoft.com/en-us/library/ms525539.aspx

 

<Iisapplicationpool location = "/lm/w3svc/apppools/defaultapppool"
Apppoolautostart = "true"
Periodicrestartmemory = "2000" // maximum virtual memory MB
Periodicrestartprivatememory = "1000" // maximum memory usage MB
Periodicrestartrequests = "1000" // number of requests
Periodicrestartschedule = "// automatic recovery time
12: 00
20: 00"
>
</Iisapplicationpool>

Code

Protected void startstoprecycleapp (string method)
{
String apppoolname = "defaultapppool ";

Try
{
Directoryentry apppool = new directoryentry ("IIS: // localhost/w3svc/apppools ");
Directoryentry findpool = apppool. Children. Find (apppoolname, "iisapplicationpool ");

Findpool. properties ["periodicrestartmemory"]. value = (object) 512000; // set the maximum virtual memory occupied
Findpool. properties ["periodicrestartprivatememory"]. value = (object) 200000; // you can specify the maximum physical memory usage.
String [] strpamer = {"07:50", "12:00", "20:00 "};
Findpool. properties ["periodicrestartschedule"]. value = (object) strpamer; // set the automatic recycle time
Findpool. commitchanges ();
Apppool. commitchanges ();
Apppool. Close ();
}
Catch (exception ex)
{
MessageBox. Show (ex. Message );
// Lbmsg. Text = string. Format ("Application Program Pool {0} {2} failed: {1} ", apppoolname, Ex. Message, method );
}
}

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.