Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Changing IIS 6/7 Application Pool settings programmatically

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?

like image 845
Kottan Avatar asked Jan 28 '10 13:01

Kottan


2 Answers

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

like image 198
Alexander G Avatar answered Sep 26 '22 11:09

Alexander G


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>();
...
like image 37
Michael Krauklis Avatar answered Sep 26 '22 11:09

Michael Krauklis