title: Create an application pool that uses .NET 4.0
body: <p>I use the following code to create a app pool:</p>
  
  <pre><code>var metabasePath = string.Format(@"IIS://{0}/W3SVC/AppPools", serverName);
  DirectoryEntry newpool;
  DirectoryEntry apppools = new DirectoryEntry(metabasePath);
  newpool = apppools.Children.Add(appPoolName, "IIsApplicationPool");
  newpool.CommitChanges();
  </code></pre>
  
  <p>How do I specify that the app pool should use .NET Framework 4.0?</p>