I'm trying to create application pool using the ServerManager
class. This is my code:
using (ServerManager serverManager = new ServerManager()) {
if (!serverManager.ApplicationPools.Any(p => p.Name == poolName)) {
ApplicationPool newPool = serverManager.ApplicationPools.Add(poolName);
newPool.ManagedRuntimeVersion = "v4.0";
newPool.ManagedPipelineMode = ManagedPipelineMode.Integrated;
newPool.ProcessModel.IdentityType = ProcessModelIdentityType.SpecificUser;
newPool.ProcessModel.UserName = user;
newPool.ProcessModel.Password = pass;
serverManager.CommitChanges();
}
}
The application pool gets created, but no identity is set for it - the identity column in the application pools table in IIS Manager is blank. What am i doing wrong?
User is in the form of domain\username, and the credentials passed are correct (another part of code checks for those).