I am making an application that creates several application pools and webs on IIS.
I need to enable 32 bit applications in one of them.
How can I do it programatically?
I am making an application that creates several application pools and webs on IIS.
I need to enable 32 bit applications in one of them.
How can I do it programatically?
You did not specify IIS version. For old ones, one could use DirectoryServices as described here: https://msdn.microsoft.com/en-us/library/ms525598%28v=vs.90%29.aspx?f=255&MSPPError=-2147217396
The property for 32 bit should be "Enable32BitAppOnWin64" if I rememeber correctly.
For IIS 7+, you should use Microsoft.Web.Administration namespace as described here: https://www.iis.net/learn/manage/scripting/how-to-use-microsoftwebadministration
This is a managed api. Check the reference posted or experiment a little.
Also, if you have IIS Metabase Compatibility installed with IIS 7, the first solution should work too. (Not available on newer systems)
Example using DirectoryServices:
var appPool = new DirectoryEntry(string.Format("IIS://{0}/w3svc/apppools/DefaultAppPool", Environment.MachineName));
//Integrated mode
appPool.InvokeSet("ManagedPipelineMode", new object[] { 0 });
appPool.InvokeSet("MaxProcesses", new object[] { 1 });
//Enable 32-bit Applications
appPool.InvokeSet("Enable32BitAppOnWin64", new object[] { true });
appPool.CommitChanges();