I've written a small tool that installs a web application and all needed software packages on a windows server. The tool creates application pools and the needed applications. On my development machine everything works fine, but on a test server (fresh w2k8r2 install with iis) the tool crashes with the following exception:
System.MissingMethodException: Method not found: 'Void Microsoft.Web.Administration.ApplocationPool.set_Startmode(Microsoft.Web.Administration.Startmode)'
This is the code I use to create the appPool:
using (ServerManager serverManager = new ServerManager())
{
try
{
if (!serverManager.ApplicationPools.Any(x => x.Name == appPoolName))
{
ApplicationPool appPool = serverManager.ApplicationPools.Add(appPoolName);
appPool.ManagedRuntimeVersion = "v4.0";
appPool.StartMode = StartMode.AlwaysRunning;
appPool.ProcessModel.IdentityType = ProcessModelIdentityType.LocalSystem;
serverManager.CommitChanges();
}
result = true;
}
catch (Exception e)
{
Console.WriteLine(e);
}
}
I have installed the IIS managament tools and scripts with the server manager. Am I missing a package or is my code wrong?
Update:
As PhillipH wrote in his answer the IIS 7.5 does not support the property StartMode.