Thursday, January 6, 2011

Create app in IIS7

using(ServerManager iisManager = new ServerManager())
{
var site = iisManager.Sites["Default Web Site"];

if (site == null)
return;

if (site.Applications["/" + applicationName] == null)
site.Applications.Add("/" + applicationName, physicalPath);

iisManager.CommitChanges();
}