c# - Create an application pool that uses .NET 4.0 -


i use following code create app pool:

var metabasepath = string.format(@"iis://{0}/w3svc/apppools", servername); directoryentry newpool; directoryentry apppools = new directoryentry(metabasepath); newpool = apppools.children.add(apppoolname, "iisapplicationpool"); newpool.commitchanges(); 

how specify app pool should use .net framework 4.0?

i see tags you're using iis7. unless absolutely have to, don't use iis6 compatibility components. preferred approach should use microsoft.web.administration managed api.

to create application pool using , set .net framework version 4.0, this:

using microsoft.web.administration; ...  using(servermanager servermanager = new servermanager()) {   applicationpool newpool = servermanager.applicationpools.add("mynewpool");   newpool.managedruntimeversion = "v4.0";   servermanager.commitchanges(); } 

you should add reference microsoft.web.administration.dll can found in:

%systemroot%\system32\inetsrv


Comments

Popular posts from this blog

java - SNMP4J General Variable Binding Error -

windows - Python Service Installation - "Could not find PythonClass entry" -

Determine if a XmlNode is empty or null in C#? -