I am trying to add Application Pool. My code:
ServerManager iis = new ServerManager();
iis.ApplicationPools.Add(new ApplicationPool() {Name= "My Pool",
AutoStart=true,ManagedRuntimeVersion="v4.0", ManagedPipelineMode=ManagedPipelineMode.Integrated });
Problem is I cant create object ApplicationPool. The reason is probably that the class it inherits has a protected internal constructor. And the error is displayed that there is no such overload of the constructor for this class.
But I think I should be able to create an object of this class somehow, because the Add method accepts this type of object. It has a second overload where it accepts a string.
Edit:
It works but I don't want to do it this way
iis.ApplicationPools.Add("My poll");
foreach (ApplicationPool item in applicationPool)
{
if (item.Name == "My poll")
{
item.AutoStart = true;
item.ManagedRuntimeVersion = "v4.0";
item.ManagedPipelineMode = ManagedPipelineMode.Integrated;
iis.CommitChanges();
}
}
I find this:
var item = iis.ApplicationPools.Add("My poll");
item.AutoStart = true;
item.ManagedRuntimeVersion = "v4.0";
item.ManagedPipelineMode = ManagedPipelineMode.Integrated;
item.Enable32BitAppOnWin64 = true;
