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();
}