I want to create a web site in my setup project using Microsoft.Web.Administration.ServerManager.Sites.Add method, but it needs a physical path of the web site to be specified. I want the web site to be created at it’s default location. How can I find out the physical path of the default location?
I want to create a web site in my setup project using Microsoft.Web.Administration.ServerManager.Sites.Add method,
Share
Typically when adding a new site this would have a different directory to any pre-existing site. For example IIS comes preconfigured with “Default Web Site” site and the physical path for this typically points to:
You would not normally create a second site that also points to that directory. As an example you might configure the second site to point to (or any other preferred location):
That said, if you really want to have multiple sites with the same physical path then you should be able to use
Microsoft.Web.Administration.ServerManager.Sitesproperty to enumerate all current sites and from there extract the physical path.