c# - Programmatically create Application Pool, error setting "ManagedPipelineMode" -
i creating application pool iis 6 (windows server 2003r2) programmatically using following code, getting error on line trying set managedpipelinemode
attempt 1
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 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();
attempt 2
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 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();
the same exception thrown either way.
exception:
exception hresult: 0x80005006 @ system.directoryservices.interop.unsafenativemethods.iads.putex(int32 lncontrolcode, string bstrname, object vprop) @ system.directoryservices.propertyvaluecollection.onclearcomplete() @ system.directoryservices.propertyvaluecollection.set_value(object value)
turns out issue bit more fundamental thought. first of all, iis 6 doesn't support integrated pipeline mode, switch managedpipelinemode
doesn't exist. also, enable32bitapponwin64
doesn't exist in fashion either, turn feature on, command has run (http://extended64.com/blogs/rhoffman/archive/2005/05/10/482.aspx)
Comments
Post a Comment