Unable to create dynamic web application in IIS7 and above
- by Dhwani
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.