Proper folder location when creating virtual direc

2019-07-23 02:47发布

问题:

When creating new web sites with Visual Studio .NET, the projects are created at the default web site location, e.g. c:\inetpub\wwwroot\myapp. Likewise, when creating msi packages for such applications using a Visual Studio Web Deployment Project, a custom action will be used to determine the folder location of the default web site and the files installed to that location.

When I look at other virtual directories in my current IIS installation, I see these logical paths:

IISHelp: c:\windows\help\iishelp Reports: c:\Program Files\Microsoft SQL Server\MSSQL.3\Reporting Services\ReportManager ReportServer: c:\Program Files\Microsoft SQL Server\MSSQL.3\Reporting Services\ReportServer crystalreportviewers12: C:\Program Files\Business Objects\Common\4.0\crystalreportviewers12

My question is: Is c:\inetpub\wwwroot really the correct location to use, even if the virtual directory is created under the default web site? Would it not be more appropriate to install the files to c:\Program Files\myapp, create a virtual directory, and then point that virtual directory to that folder (making sure that the proper permissions have been assigned to the folder, as it will not inherit any permissions from c:\inetpub\wwwroot)?

Any links to official guidelines on this topic would be most welcome.

回答1:

It really doesn't matter as long as you tell IIS the path. I stick to the inetpub/wwwroot directory. That way I can apply certain security sites to that path. It also helps establish various security users such as ASP.net and the network user account.



回答2:

One of the main reasons to stick to the standard c:\inetpub\wwwroot\ directory for placing your applications is Windows has set up the permissions properly on this directory to propagate to subdirectories for web applications. I would recommend sticking with this standard so you have a logical central point for your various sites/applications. It's really just organized.

Now I won't deny that you can set up additional root directories, and sometimes this is needed at various client/customer sites if you have separate hard drives for particular sites, etc. Here's a link regarding setting up root directories for .net:

http://msdn.microsoft.com/en-us/library/ha2y9493.aspx



回答3:

I tend to keep vdirs pointing to the same folder as the source code, something like C:\source\mywebapp. This way everything is in the one folder and source control is much cleaner.

Another reason could be that your server admin (or you) prefer to keep just OS stuff on C: and keep data or inhouse apps on D: (or some other drive). This can make it easier to maintain or might just be policy.

I suggest not concerning yourself about where your vdirs are pointed, they are only "virtual" after all. Just make sure that your content is stored in a safe and logical place.