How can I programmatically change IIS application pools' settings and properties (for example: the Enable 32-Bit Applications
setting)?
Are there reference guides on properties for IIS 6 or 7 on MSDN or Technet?
You can solve the problem using appcmd.exe. Where "DefaultAppPool" is the name of the pool.
appcmd list apppool /xml "DefaultAppPool" | appcmd set apppool /in /enable32BitAppOnWin64:true
If you have any troubles with running it using C# take a look How To: Execute command line in C#.
ps: Additional information about appcmd.exe you can find here. Default location of the tool is C:\windows\system32\inetsrv
Try this on for size.
DirectoryEntry root = this.GetDirectoryEntry("IIS://" + this.DomainName + "/W3SVC/AppPools");
if (root == null)
return null;
List<ApplicationPool> Pools = new List<ApplicationPool>();
...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With