Setting property Enable32BitAppOnWin64 for IIS 7 in C#
-
ServerManager mgr = new ServerManager();
mgr.ApplicationPools["test"].Enable32BitAppOnWin64 = true;
mgr.CommitChanges();Above code should set property Enable32BitAppOnWin64 to true for application pool having name test, but it doesn't do that, can anyone please tell what am I doing wrong. Please note that ServerManager class is present in Microsoft.Web.Administration namespace.
Thanks, Mushq
-
ServerManager mgr = new ServerManager();
mgr.ApplicationPools["test"].Enable32BitAppOnWin64 = true;
mgr.CommitChanges();Above code should set property Enable32BitAppOnWin64 to true for application pool having name test, but it doesn't do that, can anyone please tell what am I doing wrong. Please note that ServerManager class is present in Microsoft.Web.Administration namespace.
Thanks, Mushq
Do you get any exceptions? I use the following code and it works fine for me (cutdown a bit):
using (ServerManager mgr = new ServerManager())
{
ApplicationPool appPool = mgr.ApplicationPools[appPoolName];
if (appPool == null)
throw new ApplicationException(string.Format("The pool {0} does not exist", appPoolName));
appPool.Enable32BitAppOnWin64 = true;
mgr.CommitChanges();
}Deja View - the feeling that you've seen this post before.
-
Do you get any exceptions? I use the following code and it works fine for me (cutdown a bit):
using (ServerManager mgr = new ServerManager())
{
ApplicationPool appPool = mgr.ApplicationPools[appPoolName];
if (appPool == null)
throw new ApplicationException(string.Format("The pool {0} does not exist", appPoolName));
appPool.Enable32BitAppOnWin64 = true;
mgr.CommitChanges();
}Deja View - the feeling that you've seen this post before.
Hi Pete, Thanks for the response and sorry for the late reply.
Pete O'Hanlon wrote:
Do you get any exceptions?
No, I don't get any exception. I have observed when i try to set property through code it shows me that the property has been successfully changed to true even next time I try to get that property programmatically it shows me that property is true, but when I open that in IIS it shows me that property to be false. Please check the screen shot for that. http://img87.imageshack.us/my.php?image=iiswin32bitcheckmf6.jpg[^]
Kind Regards, Mushq
-
Do you get any exceptions? I use the following code and it works fine for me (cutdown a bit):
using (ServerManager mgr = new ServerManager())
{
ApplicationPool appPool = mgr.ApplicationPools[appPoolName];
if (appPool == null)
throw new ApplicationException(string.Format("The pool {0} does not exist", appPoolName));
appPool.Enable32BitAppOnWin64 = true;
mgr.CommitChanges();
}Deja View - the feeling that you've seen this post before.
Hi Pete O'Hanlon, I was checking that property incorrectly, you are right that your mentioned code is working fine. Thanks a lot.
Kind Regards, Mushq