Earlier versions of SharePoint did make some use of the .NET Framework, but SharePoint 2007 has been rebuilt from ground up on top of it, meaning SharePoint applications are in fact tremendously powerful ASP.NET applications.
What are Application Pools?
A classic example that I always utilize to discuss application pools is a web hosting company that hosts many websites on a common server, and therefore all the websites hosted on this server share the system resources. If one of the hosted websites had a memory leak, this potentially takes memory away from the other hosted sites, causing errors and inconveniences.
Prior to IIS 6.0, at least, that was the case. Too many server resources were shared between websites, and it was too easy for an error to creep in and damage the entire server process.
Fortunately, IIS 6.0 introduced a new concept called application pools. Application pools form boundaries around applications, separating them from each other even though they are being hosted on the same server.
Each application pool is given its own set of server resources (including memory). That way, the hosting company can now host each website in its own application pool to accomplish security, reliability, and availability and to prevent the leaky or misbehaving site from affecting other sites.
Application Pools in SharePoint Object Model
The SharePoint OM comprises types whose instances correspond to IIS entities such as application pools, web sites,…. These types permit you to program against these entities within your code
SharePoint represents each IIS application pool with an instance of a type named SPApplicationPool, which allows you to program against IIS application pools from your managed code. Here are some of the public methods of the SPApplicationPool class that you can use in your managed code:
- Provision. This method creates the application pool.
- Unprovision. This method removes the application pool.
- Update. This method updates and commits the changes made to the application pool.
- UpdateCredentials. This method updates and commits the credentials under which the
application pool is running.
1: SPWebServiceCollection wsc = new SPWebServiceCollection(SPFarm.Local);
2: foreach (SPWebService ws in wsc)
4: SPApplicationPoolCollection appPoolCollection= ws.ApplicationPools;
5: foreach (SPApplicationPool appPool in appPoolCollection)
7: // Your code