Unable to create dynamic web application in IIS7 and above
Posted
by
Dhwani
on Programmers
See other posts from Programmers
or by Dhwani
Published on 2014-06-13T12:10:31Z
Indexed on
2014/06/13
15:40 UTC
Read the original article
Hit count: 590
Not able to view application in IIS after successfully calling below method:
ServerManager serverMgr = new ServerManager();
Configuration config = serverMgr.GetApplicationHostConfiguration();
ConfigurationSection isapiCgiRestrictionSection = config.GetSection("system.webServer/security/isapiCgiRestriction");
ConfigurationElementCollection isapiCgiRestrictionCollection = isapiCgiRestrictionSection.GetCollection();
//ConfigurationElement addElement = isapiCgiRestrictionCollection.CreateElement("add");
//addElement["path"] = @"C:\Inetpub\wwwroot\";
//addElement["allowed"] = true;
//addElement["groupId"] = @"ContosoGroup";
//addElement["description"] = @"Contoso Extension";
//isapiCgiRestrictionCollection.Add(addElement);
//serverMgr.CommitChanges();
Site defaultSite = serverMgr.Sites["PharmaConnect"];
defaultSite.Applications.Add("/blogs3", @"C:\inetpub\wwwroot\blogs1");
serverMgr.CommitChanges();
I don't know how to create dynamically sub domain though c# code. We just tried to implement above. But unable to view application/virtual directory in iis.
I have tried this, but didn't get success.
© Programmers or respective owner