Note that there are some explanatory texts on larger screens.

plurals
  1. POProgrammatically create Application Pool, error setting "ManagedPipelineMode"
    primarykey
    data
    text
    <p>I am creating an application pool for IIS 6 (Windows Server 2003R2) programmatically using the following code, but getting an error on the line that is trying to set the <code>ManagedPipelineMode</code></p> <p><strong>Attempt 1</strong></p> <pre><code> string metabasePath = @"IIS://localhost/W3SVC/AppPools"; DirectoryEntry apppools = new DirectoryEntry(metabasePath); DirectoryEntry newpool = apppools.Children.Add(AppPoolName, "IIsApplicationPool"); newpool.Properties["managedRuntimeVersion"].Value = "v4.0"; newpool.InvokeSet("ManagedPipelineMode", new Object[] { 0 }); //exception thrown on this line newpool.Properties["Enable32BitAppOnWin64"].Value = true; if (!string.IsNullOrEmpty(username)) { newpool.Properties["AppPoolIdentityType"].Value = 3; newpool.Properties["WAMUserName"].Value = username; newpool.Properties["WAMUserPass"].Value = password; } newpool.CommitChanges(); </code></pre> <p><strong>Attempt 2</strong></p> <pre><code> string metabasePath = @"IIS://localhost/W3SVC/AppPools"; DirectoryEntry apppools = new DirectoryEntry(metabasePath); DirectoryEntry newpool = apppools.Children.Add(AppPoolName, "IIsApplicationPool"); newpool.Properties["managedRuntimeVersion"].Value = "v4.0"; newpool.Properties["ManagedPipelineMode"][0] = 0; //exception thrown on this line newpool.Properties["Enable32BitAppOnWin64"].Value = true; if (!string.IsNullOrEmpty(username)) { newpool.Properties["AppPoolIdentityType"].Value = 3; newpool.Properties["WAMUserName"].Value = username; newpool.Properties["WAMUserPass"].Value = password; } newpool.CommitChanges(); </code></pre> <p>The same exception is thrown either way.</p> <p><em>Exception:</em></p> <pre><code>Exception from HRESULT: 0x80005006 at System.DirectoryServices.Interop.UnsafeNativeMethods.IAds.PutEx(Int32 lnControlCode, String bstrName, Object vProp) at System.DirectoryServices.PropertyValueCollection.OnClearComplete() at System.DirectoryServices.PropertyValueCollection.set_Value(Object value) </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload