Objectmix
Tags Register Mark Forums Read

C# DirectoryServices Creating an IIS website on Windows2003 : Inetserver

This is a discussion on C# DirectoryServices Creating an IIS website on Windows2003 within the Inetserver forums in Microsoft Tools category; Hi, I am using the System.DirectoryServices namespace to create a virtual directory and an AppPool on my webserver and then associate that AppPool to that webserver. I seem to be encountering some issues that I cannot resolve and wonder if anyone has run into them. Oddly enough these issues are happening on W2K3 (IIS6), but when I run the same code against Vista (IIS7) everything works as it should. I am also using .NET 2.0. a) I set the AppFriendlyName of the ApplicationName when assigning the AppPool to the virtual directory and it is always blank when I open up ...


Object Mix > Microsoft Tools > Inetserver > C# DirectoryServices Creating an IIS website on Windows2003

Inetserver Microsoft Inet server asp, iis, ftp, smtp and security related discussions

Reply

 

LinkBack Thread Tools
  #1  
Old 02-29-2008, 03:25 PM
Junior Member
 
Join Date: Nov 2009
Posts: 0
Application Development is on a distinguished road
Default C# DirectoryServices Creating an IIS website on Windows2003

Hi,

I am using the System.DirectoryServices namespace to create a virtual
directory and an AppPool on my webserver and then associate that
AppPool to that webserver.

I seem to be encountering some issues that I cannot resolve and wonder
if anyone has run into them. Oddly enough these issues are happening
on W2K3 (IIS6), but when I run the same code against Vista (IIS7)
everything works as it should. I am also using .NET 2.0.

a) I set the AppFriendlyName of the ApplicationName when assigning the
AppPool to the virtual directory and it is always blank when I open up
the virtual directory. The Application is there because I have the
option to remove it but otherwise it is blank.

b) I can create the AppPool but I cannot assign AppPoolIdentityType to
LocalSystem (0), it always goes to NetworkService (which I presume is
the default).

Do I need to create the pool first and then modify these values (for
b)?

Any help would be appreciated.

Thank you - Greg.
  #2  
Old 03-01-2008, 02:52 AM
Junior Member
 
Join Date: Nov 2009
Posts: 0
Application Development is on a distinguished road
Default Re: C# DirectoryServices Creating an IIS website on Windows2003

On Feb 29, 12:25 pm, Greg <grtho...@magma.ca> wrote:
> Hi,
>
> I am using the System.DirectoryServices namespace to create a virtual
> directory and an AppPool on my webserver and then associate that
> AppPool to that webserver.
>
> I seem to be encountering some issues that I cannot resolve and wonder
> if anyone has run into them.  Oddly enough these issues are happening
> on W2K3 (IIS6), but when I run the same code against Vista (IIS7)
> everything works as it should.  I am also using .NET 2.0.
>
> a) I set the AppFriendlyName of the ApplicationName when assigning the
> AppPool to the virtual directory and it is always blank when I open up
> the virtual directory.  The Application is there because I have the
> option to remove it but otherwise it is blank.
>
> b) I can create the AppPool but I cannot assign AppPoolIdentityType to
> LocalSystem (0), it always goes to NetworkService (which I presume is
> the default).
>
> Do I need to create the pool first and then modify these values (for
> b)?
>
> Any help would be appreciated.
>
> Thank you - Greg.




It depends on the version of IIS6 SP and .Net Framework version SP.
Yes, both issues were resolved within their SP.

There were a variety of bugs in System.DirectoryServices and IIS6's
own providers in WS03 RTM which hindered proper operation of the
managed classes on IIS6 by default. They were all fixed by the time of
IIS7.

a. Those are not necessary for proper functionality to associate an
Application Pool to an Application, so while strange, it is not
critical.
b. With ADSI you can create and assign the type all at once so if you
can't do that, probably a bug in the version combination in your
system

The important things are:
1. Create a node under W3SVC/AppPools with KeyType IIsApplicationPool
(so that ADSI will work against those nodes) and various application
properties underneath that node
2. Create AppPoolId property under W3SVC/<site-ID/ROOT[/Path] to map [/
Path] to be handled by the specified AppPoolId, whose name matches the
node name under W3SVC/AppPools


//David
http://w3-4u.blogspot.com
http://blogs.msdn.com/David.Wang
//
  #3  
Old 03-03-2008, 09:46 AM
Junior Member
 
Join Date: Nov 2009
Posts: 0
Application Development is on a distinguished road
Default Re: C# DirectoryServices Creating an IIS website on Windows2003

Hi David,

Could be I am just doing things wrong here... but I added the
AppPoolID property to my code and saw no difference in IIS 6.

Here is what I am doing to create the AppPool;

DirectoryEntry AppPool = new DirectoryEntry("IIS://LOCALHOST/W3SVC/
AppPools");
DirectoryEntry NewAppPool = AppPool.Children.Add("NEWPOOL",
"IISApplicationPool");

NewAppPool.InvokeSet("AppPoolId", new Object[] { IIS_APPPOOL_NAME });
NewAppPool.InvokeSet("AppPoolIdentityType", new Object[] { 0 }); //0 -
LocalSystem, 1 - LocalService, 2 - NetworkService, 3 SpecifiedUser
NewAppPool.InvokeSet("ManagedPipelineMode", new Object[] { 1 }); //0 -
Integrated, 1 - Classic
NewAppPool.Properties["AppPoolQueueLength"].Value = 4000;
NewAppPool.Properties["managedRuntimeVersion"].Value = "v2.0";
NewAppPool.Invoke("SetInfo", null);
NewAppPool.CommitChanges();

Thanks - Greg.

On Mar 1, 2:52 am, David Wang <w3.4...@gmail.com> wrote:
> On Feb 29, 12:25 pm, Greg <grtho...@magma.ca> wrote:
>
>
>
>
>
> > Hi,

>
> > I am using the System.DirectoryServices namespace to create a virtual
> > directory and an AppPool on my webserver and then associate that
> > AppPool to that webserver.

>
> > I seem to be encountering some issues that I cannot resolve and wonder
> > if anyone has run into them.  Oddly enough these issues are happening
> > on W2K3 (IIS6), but when I run the same code against Vista (IIS7)
> > everything works as it should.  I am also using .NET 2.0.

>
> > a) I set the AppFriendlyName of the ApplicationName when assigning the
> > AppPool to the virtual directory and it is always blank when I open up
> > the virtual directory.  The Application is there because I have the
> > option to remove it but otherwise it is blank.

>
> > b) I can create the AppPool but I cannot assign AppPoolIdentityType to
> > LocalSystem (0), it always goes to NetworkService (which I presume is
> > the default).

>
> > Do I need to create the pool first and then modify these values (for
> > b)?

>
> > Any help would be appreciated.

>
> > Thank you - Greg.

>
> It depends on the version of IIS6 SP and .Net Framework version SP.
> Yes, both issues were resolved within their SP.
>
> There were a variety of bugs in System.DirectoryServices and IIS6's
> own providers in WS03 RTM which hindered proper operation of the
> managed classes on IIS6 by default. They were all fixed by the time of
> IIS7.
>
> a. Those are not necessary for proper functionality to associate an
> Application Pool to an Application, so while strange, it is not
> critical.
> b. With ADSI you can create and assign the type all at once so if you
> can't do that, probably a bug in the version combination in your
> system
>
> The important things are:
> 1. Create a node under W3SVC/AppPools with KeyType IIsApplicationPool
> (so that ADSI will work against those nodes) and various application
> properties underneath that node
> 2. Create AppPoolId property under W3SVC/<site-ID/ROOT[/Path] to map [/
> Path] to be handled by the specified AppPoolId, whose name matches the
> node name under W3SVC/AppPools
>
> //Davidhttp://w3-4u.blogspot.comhttp://blogs.msdn.com/David.Wang
> //- Hide quoted text -
>
> - Show quoted text -


  #4  
Old 03-03-2008, 11:46 AM
Junior Member
 
Join Date: Nov 2009
Posts: 0
Application Development is on a distinguished road
Default Re: C# DirectoryServices Creating an IIS website on Windows2003

ManagedPipelineMode and ManagedRuntimeVersion are not valid values on
Application Pools for IIS6.


//David
http://w3-4u.blogspot.com
http://blogs.msdn.com/David.Wang
//




On Mar 3, 6:46 am, Greg <grtho...@magma.ca> wrote:
> Hi David,
>
> Could be I am just doing things wrong here... but I added the
> AppPoolID property to my code and saw no difference in IIS 6.
>
> Here is what I am doing to create the AppPool;
>
> DirectoryEntry AppPool = new DirectoryEntry("IIS://LOCALHOST/W3SVC/
> AppPools");
> DirectoryEntry NewAppPool = AppPool.Children.Add("NEWPOOL",
> "IISApplicationPool");
>
> NewAppPool.InvokeSet("AppPoolId", new Object[] { IIS_APPPOOL_NAME });
> NewAppPool.InvokeSet("AppPoolIdentityType", new Object[] { 0 }); //0 -
> LocalSystem, 1 - LocalService, 2 - NetworkService, 3 SpecifiedUser
> NewAppPool.InvokeSet("ManagedPipelineMode", new Object[] { 1 }); //0 -
> Integrated, 1 - Classic
> NewAppPool.Properties["AppPoolQueueLength"].Value = 4000;
> NewAppPool.Properties["managedRuntimeVersion"].Value = "v2.0";
> NewAppPool.Invoke("SetInfo", null);
> NewAppPool.CommitChanges();
>
> Thanks - Greg.
>
> On Mar 1, 2:52 am, David Wang <w3.4...@gmail.com> wrote:
>
>
>
> > On Feb 29, 12:25 pm, Greg <grtho...@magma.ca> wrote:

>
> > > Hi,

>
> > > I am using the System.DirectoryServices namespace to create a virtual
> > > directory and an AppPool on my webserver and then associate that
> > > AppPool to that webserver.

>
> > > I seem to be encountering some issues that I cannot resolve and wonder
> > > if anyone has run into them.  Oddly enough these issues are happening
> > > on W2K3 (IIS6), but when I run the same code against Vista (IIS7)
> > > everything works as it should.  I am also using .NET 2.0.

>
> > > a) I set the AppFriendlyName of the ApplicationName when assigning the
> > > AppPool to the virtual directory and it is always blank when I open up
> > > the virtual directory.  The Application is there because I have the
> > > option to remove it but otherwise it is blank.

>
> > > b) I can create the AppPool but I cannot assign AppPoolIdentityType to
> > > LocalSystem (0), it always goes to NetworkService (which I presume is
> > > the default).

>
> > > Do I need to create the pool first and then modify these values (for
> > > b)?

>
> > > Any help would be appreciated.

>
> > > Thank you - Greg.

>
> > It depends on the version of IIS6 SP and .Net Framework version SP.
> > Yes, both issues were resolved within their SP.

>
> > There were a variety of bugs in System.DirectoryServices and IIS6's
> > own providers in WS03 RTM which hindered proper operation of the
> > managed classes on IIS6 by default. They were all fixed by the time of
> > IIS7.

>
> > a. Those are not necessary for proper functionality to associate an
> > Application Pool to an Application, so while strange, it is not
> > critical.
> > b. With ADSI you can create and assign the type all at once so if you
> > can't do that, probably a bug in the version combination in your
> > system

>
> > The important things are:
> > 1. Create a node under W3SVC/AppPools with KeyType IIsApplicationPool
> > (so that ADSI will work against those nodes) and various application
> > properties underneath that node
> > 2. Create AppPoolId property under W3SVC/<site-ID/ROOT[/Path] to map [/
> > Path] to be handled by the specified AppPoolId, whose name matches the
> > node name under W3SVC/AppPools

>
> > //Davidhttp://w3-4u.blogspot.comhttp://blogs.msdn.com/David.Wang
> > //- Hide quoted text -

>
> > - Show quoted text -- Hide quoted text -

>
> - Show quoted text -


  #5  
Old 03-07-2008, 09:36 AM
Junior Member
 
Join Date: Nov 2009
Posts: 0
Application Development is on a distinguished road
Default Re: C# DirectoryServices Creating an IIS website on Windows2003

Hi David,

Thanks for the responses. They have been very helpful. I have gotten
my App Pool to create under local system which is fantastic. But when
I associate the App Pool to the Website I lose my Application Name
(AppFriendlyName) that was previously there. If I try and set this
myself when I associate the pool to the site it is always empty - as
recommended - (when the site is initially created I see that it does
have an application name but it is then set to empty when I associate
the app pool). It must still be there because I see the remove button
is active.

This is all I am doing here;

try
{
object[] param = { 0, m_AppPoolName, true };
IIS.Invoke("AppCreate3", param);
IIS.Properties["AppIsolated"][0] = "2";
}
catch (Exception ex)
{
m_ErrorDescription = ex.Message.ToString();
}

Also - how can I set the .NET version of a site in IIS6? Right now it
defaults to 1.1 but I want to ensure that it is set to 2.0.

Thanks for your help.

Greg

On Mar 3, 11:46 am, David Wang <w3.4...@gmail.com> wrote:
> ManagedPipelineMode and ManagedRuntimeVersion are not valid values on
> Application Pools for IIS6.
>
> //Davidhttp://w3-4u.blogspot.comhttp://blogs.msdn.com/David.Wang
> //
>
> On Mar 3, 6:46 am, Greg <grtho...@magma.ca> wrote:
>
>
>
> > Hi David,

>
> > Could be I am just doing things wrong here... but I added the
> > AppPoolID property to my code and saw no difference in IIS 6.

>
> > Here is what I am doing to create the AppPool;

>
> > DirectoryEntry AppPool = new DirectoryEntry("IIS://LOCALHOST/W3SVC/
> > AppPools");
> > DirectoryEntry NewAppPool = AppPool.Children.Add("NEWPOOL",
> > "IISApplicationPool");

>
> > NewAppPool.InvokeSet("AppPoolId", new Object[] { IIS_APPPOOL_NAME });
> > NewAppPool.InvokeSet("AppPoolIdentityType", new Object[] { 0 }); //0 -
> > LocalSystem, 1 - LocalService, 2 - NetworkService, 3 SpecifiedUser
> > NewAppPool.InvokeSet("ManagedPipelineMode", new Object[] { 1 }); //0 -
> > Integrated, 1 - Classic
> > NewAppPool.Properties["AppPoolQueueLength"].Value = 4000;
> > NewAppPool.Properties["managedRuntimeVersion"].Value = "v2.0";
> > NewAppPool.Invoke("SetInfo", null);
> > NewAppPool.CommitChanges();

>
> > Thanks - Greg.

>
> > On Mar 1, 2:52 am, David Wang <w3.4...@gmail.com> wrote:

>
> > > On Feb 29, 12:25 pm, Greg <grtho...@magma.ca> wrote:

>
> > > > Hi,

>
> > > > I am using the System.DirectoryServices namespace to create a virtual
> > > > directory and an AppPool on my webserver and then associate that
> > > > AppPool to that webserver.

>
> > > > I seem to be encountering some issues that I cannot resolve and wonder
> > > > if anyone has run into them.  Oddly enough these issues are happening
> > > > on W2K3 (IIS6), but when I run the same code against Vista (IIS7)
> > > > everything works as it should.  I am also using .NET 2.0.

>
> > > > a) I set the AppFriendlyName of the ApplicationName when assigning the
> > > > AppPool to the virtual directory and it is always blank when I open up
> > > > the virtual directory.  The Application is there because I have the
> > > > option to remove it but otherwise it is blank.

>
> > > > b) I can create the AppPool but I cannot assign AppPoolIdentityType to
> > > > LocalSystem (0), it always goes to NetworkService (which I presume is
> > > > the default).

>
> > > > Do I need to create the pool first and then modify these values (for
> > > > b)?

>
> > > > Any help would be appreciated.

>
> > > > Thank you - Greg.

>
> > > It depends on the version of IIS6 SP and .Net Framework version SP.
> > > Yes, both issues were resolved within their SP.

>
> > > There were a variety of bugs in System.DirectoryServices and IIS6's
> > > own providers in WS03 RTM which hindered proper operation of the
> > > managed classes on IIS6 by default. They were all fixed by the time of
> > > IIS7.

>
> > > a. Those are not necessary for proper functionality to associate an
> > > Application Pool to an Application, so while strange, it is not
> > > critical.
> > > b. With ADSI you can create and assign the type all at once so if you
> > > can't do that, probably a bug in the version combination in your
> > > system

>
> > > The important things are:
> > > 1. Create a node under W3SVC/AppPools with KeyType IIsApplicationPool
> > > (so that ADSI will work against those nodes) and various application
> > > properties underneath that node
> > > 2. Create AppPoolId property under W3SVC/<site-ID/ROOT[/Path] to map [/
> > > Path] to be handled by the specified AppPoolId, whose name matches the
> > > node name under W3SVC/AppPools

>
> > > //Davidhttp://w3-4u.blogspot.comhttp://blogs.msdn.com/David.Wang
> > > //- Hide quoted text -

>
> > > - Show quoted text -- Hide quoted text -

>
> > - Show quoted text -- Hide quoted text -

>
> - Show quoted text -


  #6  
Old 03-08-2008, 05:02 AM
Junior Member
 
Join Date: Nov 2009
Posts: 0
Application Development is on a distinguished road
Default Re: C# DirectoryServices Creating an IIS website on Windows2003

The only way to associate an Application Pool to an application is to
set the AppPoolId property of the application - exactly the same on
IIS6 and IIS7. Anything else -- is incorrect.

AppCreate3() and AppIsolated are for COM+ and only applicable for IIS5
Compatibility Mode, which only exists on IIS6 and are No-Op on IIS7
for compatibility reasons. They have nothing to do with associating
Application Pool to applications, so your code is incorrect to use it.

What is happening is that your incorrect code appears to run
successfully on IIS7 because AppCreate3() and AppIsolated were No-Op
and did nothing on IIS7. However on IIS6, those functions do work, so
your incorrect code fails, as expected.

The reason we keep all those functions from IIS6 and No-Op them on
IIS7 is compatibility. IF you had such working code on IIS6 and ported
it to IIS7, we wanted to ensure the code still worked the best that it
can, without changes, even if we removed features in IIS7. However,
the same cannot be said of the reverse because features introduced in
IIS7 (ManagedPipelineMode, ManagedRuntimeVersion)" obviously cannot be
configured in IIS6, and No-Op on IIS7 are not necessarily No-Op on
IIS6 and can have different side-effect.

Setting .Net version on IIS6 is done with aspnet_regiis.exe -s <path>
from the appropriate Framework version's directory and requires that
all applications in the same Application Pool use the same .Net
Framework version. You have to manually make sure of this yourself on
IIS6 -- if you do not, your managed code applications can randomly
fail to start or cause other failures.

IIS7 has various features that make this easy and automatic, such as
the two properties on Application Pools that you are setting.


//David
http://w3-4u.blogspot.com
http://blogs.msdn.com/David.Wang
//





On Mar 7, 6:36 am, Greg <grtho...@magma.ca> wrote:
> Hi David,
>
> Thanks for the responses.  They have been very helpful.  I have gotten
> my App Pool to create under local system which is fantastic.  But when
> I associate the App Pool to the Website I lose my Application Name
> (AppFriendlyName) that was previously there.  If I try and set this
> myself when I associate the pool to the site it is always empty - as
> recommended - (when the site is initially created I see that it does
> have an application name but it is then set to empty when I associate
> the app pool).  It must still be there because I see the remove button
> is active.
>
> This is all I am doing here;
>
> try
> {
> object[] param = { 0, m_AppPoolName, true };
> IIS.Invoke("AppCreate3", param);
> IIS.Properties["AppIsolated"][0] = "2";}
>
> catch (Exception ex)
> {
> m_ErrorDescription = ex.Message.ToString();
>
> }
>
> Also - how can I set the .NET version of a site in IIS6?  Right now it
> defaults to 1.1 but I want to ensure that it is set to 2.0.
>
> Thanks for your help.
>
> Greg
>
> On Mar 3, 11:46 am, David Wang <w3.4...@gmail.com> wrote:
>
>
>
> > ManagedPipelineMode and ManagedRuntimeVersion are not valid values on
> > Application Pools for IIS6.

>
> > //Davidhttp://w3-4u.blogspot.comhttp://blogs.msdn.com/David.Wang
> > //

>
> > On Mar 3, 6:46 am, Greg <grtho...@magma.ca> wrote:

>
> > > Hi David,

>
> > > Could be I am just doing things wrong here... but I added the
> > > AppPoolID property to my code and saw no difference in IIS 6.

>
> > > Here is what I am doing to create the AppPool;

>
> > > DirectoryEntry AppPool = new DirectoryEntry("IIS://LOCALHOST/W3SVC/
> > > AppPools");
> > > DirectoryEntry NewAppPool = AppPool.Children.Add("NEWPOOL",
> > > "IISApplicationPool");

>
> > > NewAppPool.InvokeSet("AppPoolId", new Object[] { IIS_APPPOOL_NAME });
> > > NewAppPool.InvokeSet("AppPoolIdentityType", new Object[] { 0 }); //0 -
> > > LocalSystem, 1 - LocalService, 2 - NetworkService, 3 SpecifiedUser
> > > NewAppPool.InvokeSet("ManagedPipelineMode", new Object[] { 1 }); //0 -
> > > Integrated, 1 - Classic
> > > NewAppPool.Properties["AppPoolQueueLength"].Value = 4000;
> > > NewAppPool.Properties["managedRuntimeVersion"].Value = "v2.0";
> > > NewAppPool.Invoke("SetInfo", null);
> > > NewAppPool.CommitChanges();

>
> > > Thanks - Greg.

>
> > > On Mar 1, 2:52 am, David Wang <w3.4...@gmail.com> wrote:

>
> > > > On Feb 29, 12:25 pm, Greg <grtho...@magma.ca> wrote:

>
> > > > > Hi,

>
> > > > > I am using the System.DirectoryServices namespace to create a virtual
> > > > > directory and an AppPool on my webserver and then associate that
> > > > > AppPool to that webserver.

>
> > > > > I seem to be encountering some issues that I cannot resolve and wonder
> > > > > if anyone has run into them.  Oddly enough these issues are happening
> > > > > on W2K3 (IIS6), but when I run the same code against Vista (IIS7)
> > > > > everything works as it should.  I am also using .NET 2.0.

>
> > > > > a) I set the AppFriendlyName of the ApplicationName when assigningthe
> > > > > AppPool to the virtual directory and it is always blank when I open up
> > > > > the virtual directory.  The Application is there because I have the
> > > > > option to remove it but otherwise it is blank.

>
> > > > > b) I can create the AppPool but I cannot assign AppPoolIdentityType to
> > > > > LocalSystem (0), it always goes to NetworkService (which I presumeis
> > > > > the default).

>
> > > > > Do I need to create the pool first and then modify these values (for
> > > > > b)?

>
> > > > > Any help would be appreciated.

>
> > > > > Thank you - Greg.

>
> > > > It depends on the version of IIS6 SP and .Net Framework version SP.
> > > > Yes, both issues were resolved within their SP.

>
> > > > There were a variety of bugs in System.DirectoryServices and IIS6's
> > > > own providers in WS03 RTM which hindered proper operation of the
> > > > managed classes on IIS6 by default. They were all fixed by the time of
> > > > IIS7.

>
> > > > a. Those are not necessary for proper functionality to associate an
> > > > Application Pool to an Application, so while strange, it is not
> > > > critical.
> > > > b. With ADSI you can create and assign the type all at once so if you
> > > > can't do that, probably a bug in the version combination in your
> > > > system

>
> > > > The important things are:
> > > > 1. Create a node under W3SVC/AppPools with KeyType IIsApplicationPool
> > > > (so that ADSI will work against those nodes) and various application
> > > > properties underneath that node
> > > > 2. Create AppPoolId property under W3SVC/<site-ID/ROOT[/Path] to map[/
> > > > Path] to be handled by the specified AppPoolId, whose name matches the
> > > > node name under W3SVC/AppPools

>
> > > > //Davidhttp://w3-4u.blogspot.comhttp://blogs.msdn.com/David.Wang
> > > > //- Hide quoted text -

>
> > > > - Show quoted text -- Hide quoted text -

>
> > > - Show quoted text -- Hide quoted text -

>
> > - Show quoted text -- Hide quoted text -

>
> - Show quoted text -


  #7  
Old 03-10-2008, 05:42 PM
Junior Member
 
Join Date: Nov 2009
Posts: 0
Application Development is on a distinguished road
Default Re: C# DirectoryServices Creating an IIS website on Windows2003

On Mar 8, 6:02 am, David Wang <w3.4...@gmail.com> wrote:
> The only way to associate an Application Pool to an application is to
> set the AppPoolId property of the application - exactly the same on
> IIS6 and IIS7. Anything else -- is incorrect.
>
> AppCreate3() and AppIsolated are for COM+ and only applicable for IIS5
> Compatibility Mode, which only exists on IIS6 and are No-Op on IIS7
> for compatibility reasons. They have nothing to do with associating
> Application Pool to applications, so your code is incorrect to use it.
>
> What is happening is that your incorrect code appears to run
> successfully on IIS7 because AppCreate3() and AppIsolated were No-Op
> and did nothing on IIS7. However on IIS6, those functions do work, so
> your incorrect code fails, as expected.
>
> The reason we keep all those functions from IIS6 and No-Op them on
> IIS7 is compatibility. IF you had such working code on IIS6 and ported
> it to IIS7, we wanted to ensure the code still worked the best that it
> can, without changes, even if we removed features in IIS7. However,
> the same cannot be said of the reverse because features introduced in
> IIS7 (ManagedPipelineMode, ManagedRuntimeVersion)" obviously cannot be
> configured in IIS6, and No-Op on IIS7 are not necessarily No-Op on
> IIS6 and can have different side-effect.
>
> Setting .Net version on IIS6 is done with aspnet_regiis.exe -s <path>
> from the appropriate Framework version's directory and requires that
> all applications in the same Application Pool use the same .Net
> Framework version. You have to manually make sure of this yourself on
> IIS6 -- if you do not, your managed code applications can randomly
> fail to start or cause other failures.
>
> IIS7 has various features that make this easy and automatic, such as
> the two properties on Application Pools that you are setting.
>
> //Davidhttp://w3-4u.blogspot.comhttp://blogs.msdn.com/David.Wang
> //
>
> On Mar 7, 6:36 am, Greg <grtho...@magma.ca> wrote:
>
>
>
> > Hi David,

>
> > Thanks for the responses.  They have been very helpful.  I have gotten
> > my App Pool to create under local system which is fantastic.  But when
> > I associate the App Pool to the Website I lose my Application Name
> > (AppFriendlyName) that was previously there.  If I try and set this
> > myself when I associate the pool to the site it is always empty - as
> > recommended - (when the site is initially created I see that it does
> > have an application name but it is then set to empty when I associate
> > the app pool).  It must still be there because I see the remove button
> > is active.

>
> > This is all I am doing here;

>
> > try
> > {
> > object[] param = { 0, m_AppPoolName, true };
> > IIS.Invoke("AppCreate3", param);
> > IIS.Properties["AppIsolated"][0] = "2";}

>
> > catch (Exception ex)
> > {
> > m_ErrorDescription = ex.Message.ToString();

>
> > }

>
> > Also - how can I set the .NET version of a site in IIS6?  Right now it
> > defaults to 1.1 but I want to ensure that it is set to 2.0.

>
> > Thanks for your help.

>
> > Greg

>
> > On Mar 3, 11:46 am, David Wang <w3.4...@gmail.com> wrote:

>
> > > ManagedPipelineMode and ManagedRuntimeVersion are not valid values on
> > > Application Pools for IIS6.

>
> > > //Davidhttp://w3-4u.blogspot.comhttp://blogs.msdn.com/David.Wang
> > > //

>
> > > On Mar 3, 6:46 am, Greg <grtho...@magma.ca> wrote:

>
> > > > Hi David,

>
> > > > Could be I am just doing things wrong here... but I added the
> > > > AppPoolID property to my code and saw no difference in IIS 6.

>
> > > > Here is what I am doing to create the AppPool;

>
> > > > DirectoryEntry AppPool = new DirectoryEntry("IIS://LOCALHOST/W3SVC/
> > > > AppPools");
> > > > DirectoryEntry NewAppPool = AppPool.Children.Add("NEWPOOL",
> > > > "IISApplicationPool");

>
> > > > NewAppPool.InvokeSet("AppPoolId", new Object[] { IIS_APPPOOL_NAME });
> > > > NewAppPool.InvokeSet("AppPoolIdentityType", new Object[] { 0 }); //0-
> > > > LocalSystem, 1 - LocalService, 2 - NetworkService, 3 SpecifiedUser
> > > > NewAppPool.InvokeSet("ManagedPipelineMode", new Object[] { 1 }); //0-
> > > > Integrated, 1 - Classic
> > > > NewAppPool.Properties["AppPoolQueueLength"].Value = 4000;
> > > > NewAppPool.Properties["managedRuntimeVersion"].Value = "v2.0";
> > > > NewAppPool.Invoke("SetInfo", null);
> > > > NewAppPool.CommitChanges();

>
> > > > Thanks - Greg.

>
> > > > On Mar 1, 2:52 am, David Wang <w3.4...@gmail.com> wrote:

>
> > > > > On Feb 29, 12:25 pm, Greg <grtho...@magma.ca> wrote:

>
> > > > > > Hi,

>
> > > > > > I am using the System.DirectoryServices namespace to create a virtual
> > > > > > directory and an AppPool on my webserver and then associate that
> > > > > > AppPool to that webserver.

>
> > > > > > I seem to be encountering some issues that I cannot resolve and wonder
> > > > > > if anyone has run into them.  Oddly enough these issues are happening
> > > > > > on W2K3 (IIS6), but when I run the same code against Vista (IIS7)
> > > > > > everything works as it should.  I am also using .NET 2.0.

>
> > > > > > a) I set the AppFriendlyName of the ApplicationName when assigning the
> > > > > > AppPool to the virtual directory and it is always blank when I open up
> > > > > > the virtual directory.  The Application is there because I have the
> > > > > > option to remove it but otherwise it is blank.

>
> > > > > > b) I can create the AppPool but I cannot assign AppPoolIdentityType to
> > > > > > LocalSystem (0), it always goes to NetworkService (which I presume is
> > > > > > the default).

>
> > > > > > Do I need to create the pool first and then modify these values (for
> > > > > > b)?

>
> > > > > > Any help would be appreciated.

>
> > > > > > Thank you - Greg.

>
> > > > > It depends on the version of IIS6 SP and .Net Framework version SP..
> > > > > Yes, both issues were resolved within their SP.

>
> > > > > There were a variety of bugs in System.DirectoryServices and IIS6's
> > > > > own providers in WS03 RTM which hindered proper operation of the
> > > > > managed classes on IIS6 by default. They were all fixed by the time of
> > > > > IIS7.

>
> > > > > a. Those are not necessary for proper functionality to associate an
> > > > > Application Pool to an Application, so while strange, it is not
> > > > > critical.
> > > > > b. With ADSI you can create and assign the type all at once so if you
> > > > > can't do that, probably a bug in the version combination in your
> > > > > system

>
> > > > > The important things are:
> > > > > 1. Create a node under W3SVC/AppPools with KeyType IIsApplicationPool
> > > > > (so that ADSI will work against those nodes) and various application
> > > > > properties underneath that node
> > > > > 2. Create AppPoolId property under W3SVC/<site-ID/ROOT[/Path] to map [/
> > > > > Path] to be handled by the specified AppPoolId, whose name matchesthe
> > > > > node name under W3SVC/AppPools

>
> > > > > //Davidhttp://w3-4u.blogspot.comhttp://blogs.msdn.com/David.Wang
> > > > > //- Hide quoted text -

>
> > > > > - Show quoted text -- Hide quoted text -

>
> > > > - Show quoted text -- Hide quoted text -

>
> > > - Show quoted text -- Hide quoted text -

>
> > - Show quoted text -- Hide quoted text -

>
> - Show quoted text -



Hi David... I figured everything on my side. Thank your assistance
and knowledge in working on this issue.

Greg
Reply

Thread Tools



All times are GMT -5. The time now is 08:51 AM.

Managed by Infnx Pvt Ltd.