Tag Archives: applicationpool-custom-user

How to set custom user for already existing application pool in IIS7 programatically

26 Jul

Here is the code through which you can set the application pool identity of an existing application pool to custom user ..

 

ServerManager serverMgr = new ServerManager();
ApplicationPool myAppPool = serverMgr.ApplicationPools[“DefaultAppPool”];
myAppPool.ProcessModel.IdentityType = ProcessModelIdentityType.SpecificUser;
myAppPool.ProcessModel.UserName = textBoxUname.Text;
myAppPool.ProcessModel.Password = textBoxPasswd.Text;
serverMgr.CommitChanges();