views:

372

answers:

2

How can I change IIS application pool seetings / properties programmatic (C#) ? For example, how can I change the setting "Enable 32-Bit Applications" ? Are there property references for IIS 6 and IIS 7 on MSDN or Technet ? Thanks in advance for your help !

+1  A: 

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>();
...
Michael Krauklis
A: 

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

alga