Referenced posts:
Separated application pool
Application pool idenity
Windows Vista comes with new property of application pool..
Now we have property "managed pipeline mode".
It allows two options:
- 0 - Integrated (set by default during creation of the new application pool)
- 1 - Classic
In the .NET 3 new .NET library Microsoft.Web.Administration allows us to manage IIS settings very easy.
Unofortunately, I was required to turn IIS settings on the Windows Vista in old way, because software product still not working with .NET 3, so I use old good way of the ADSI and System.DirectoryServices
To set application pool in classic mode on Windows Vista/IIS7, I make additional call (in bold):
string appPoolName = "myAppPool";
DirectoryEntry poolRoot = new DirectoryEntry("IIS://localhost/W3SVC/AppPools");
DirectoryEntry pool = poolRoot.Children.Add(appPoolName, "IIsApplicationPool");
pool.InvokeSet("ManagedPipelineMode", new Object[] { 1 });
pool.CommitChanges();
I set 1, because I need to set my application pool working in classic mode. 0 should be used for integrated mode.
Showing posts with label IIS. Show all posts
Showing posts with label IIS. Show all posts
Monday, October 15, 2007
Wednesday, August 29, 2007
IIS6: Application pool Identity
Referenced post: Separated app pool
In referenced post I wrote how to create application pool and assign virtual directory for it..
Now I faced with requirement to change identity from default (Network service) to Local system account) to allow web application more permissions..
Property AppPoolIdentityType should help.
Following code will create pool and set Local System account identity for the pool:
possible values:
In the case of specific user need to use following additional operations:
pool.InvokeSet("WAMUserName", new Object[] { computerName + @"\" + user });
pool.InvokeSet("WAMUserPass", new Object[] { password });
In referenced post I wrote how to create application pool and assign virtual directory for it..
Now I faced with requirement to change identity from default (Network service) to Local system account) to allow web application more permissions..
Property AppPoolIdentityType should help.
Following code will create pool and set Local System account identity for the pool:
string appPoolName = "myAppPool";
DirectoryEntry poolRoot = new DirectoryEntry("IIS://localhost/W3SVC/AppPools");
DirectoryEntry pool = poolRoot.Children.Add(appPoolName, "IIsApplicationPool");
pool.InvokeSet("AppPoolIdentityType", new Object[] { 0 });
pool.CommitChanges();
possible values:
0 | Local System |
1 | Local Service |
2 | Network Service |
3 | Specific user |
In the case of specific user need to use following additional operations:
pool.InvokeSet("WAMUserName", new Object[] { computerName + @"\" + user });
pool.InvokeSet("WAMUserPass", new Object[] { password });
Wednesday, July 11, 2007
IIS6: separated application pool
When IIS runs multiple versions of .NET web projects, collision happens sometimes.
So, I required to assign my web project in separated application pool under Windows 2003 /IIS6 programmatically.
It is easy through System.DirectoryServices of .NET
There is, I create virtual directory "myWebDir" and assign it to new pool with the name "myAppPool":
Application pool is created automatically if third parameter is a true in the param array.
However, I would like also to manage my application pools without specific virtual directory.
Here are examples to create/remove application pools:
Create Application pool:
Remove Application pool:
Remove only works, if no one web application assigned to pool.
So, I required to assign my web project in separated application pool under Windows 2003 /IIS6 programmatically.
It is easy through System.DirectoryServices of .NET
There is, I create virtual directory "myWebDir" and assign it to new pool with the name "myAppPool":
|
Application pool is created automatically if third parameter is a true in the param array.
However, I would like also to manage my application pools without specific virtual directory.
Here are examples to create/remove application pools:
Create Application pool:
|
Remove Application pool:
|
Remove only works, if no one web application assigned to pool.
Wednesday, December 06, 2006
Setup web application on Windows 2003
Windows 2003 come with NET 1.1 preinstalled. However, ASP.NET web extension may be not installed by default. It is depends on checkbox ASP.NET in the "Windows Components" of the Add/Remove Programs.
Well, I can ask user to prepare the system, before install my web application.
However, I get clear right now, it doesn't help to me. Because it is ASP.NET 1.1 and nothing more. So, I leave user without stupid requirements and do following.
My setup installs .NET 2
My setup registers ASP.NET 2 through aspnet_regiis.exe
But ASP.NET web extension appears in the IIS settings as prohibited
Ok, another day for search/trying/insomnia and my C# application running from the setup, will do things right:
Bingo!
User installs my web application setup, and doesn't complain. :)
I found also other usefull methods:
-----------
If we want to check, is ASP.NET installed at all
we should use ListWebServiceExtensions and search for ASP.NET in the returned list of extensions.
System.Array installedObj = (System.Array)folderRoot.Invoke("ListWebServiceExtensions", null);
-----------
Also we can check, is web extension restricted or not. If ASP.NET is restricted, then property WebSvcExtRestrictionList will return list containing ASP.NET:
System.Array restrictedObj = (System.Array)folderRoot.Properties["WebSvcExtRestrictionList"].Value;
Well, I can ask user to prepare the system, before install my web application.
However, I get clear right now, it doesn't help to me. Because it is ASP.NET 1.1 and nothing more. So, I leave user without stupid requirements and do following.
My setup installs .NET 2
My setup registers ASP.NET 2 through aspnet_regiis.exe
But ASP.NET web extension appears in the IIS settings as prohibited
Ok, another day for search/trying/insomnia and my C# application running from the setup, will do things right:
|
Bingo!
User installs my web application setup, and doesn't complain. :)
I found also other usefull methods:
-----------
If we want to check, is ASP.NET installed at all
we should use ListWebServiceExtensions and search for ASP.NET in the returned list of extensions.
System.Array installedObj = (System.Array)folderRoot.Invoke("ListWebServiceExtensions", null);
-----------
Also we can check, is web extension restricted or not. If ASP.NET is restricted, then property WebSvcExtRestrictionList will return list containing ASP.NET:
System.Array restrictedObj = (System.Array)folderRoot.Properties["WebSvcExtRestrictionList"].Value;
Subscribe to:
Posts (Atom)