Bogdan Verbenets
Bogdan Verbenets

Reputation: 26952

create a web site using Microsoft.Web.Administration.ServerManager.Sites.Add

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?

Upvotes: 2

Views: 1436

Answers (1)

MrEyes
MrEyes

Reputation: 13750

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:

%SystemDrive%\inetpub\wwwroot

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):

%SystemDrive%\inetpub\wwwroot_secondsite\

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.Sites property to enumerate all current sites and from there extract the physical path.

Upvotes: 1

Related Questions