Should I put my ASP.NET websites in the wwwroot folder?

asp.netIisHosting

asp.net Problem Overview


I have a number of websites that run under IIS on a single machine.

Should I put these websites inside of the C:\inetpub\wwwroot\ folder or inside the C:\inetpub\ folder?

E.g.

  • C:\inetpub\wwwroot\Website1\
  • C:\inetpub\wwwroot\Website2\

or

  • C:\inetpub\Website1\
  • C:\inetpub\Website2\

Are there any pros/cons for either or another recommended location (I only have a C drive on this machine)?

I am not sure whether there is a "correct" answer to this, but want to follow best practice if there is one.

Many thanks, Jonathan

asp.net Solutions


Solution 1 - asp.net

Go the second route.

wwwroot is simply there as the container for the default website for the server. If you delete the default website from within IIS, then you can safely remove this directory. Regardless, your sites have nothing to do with the default, so they should be in their own folders under inetpub.

That said, we sometimes have multiple "types" of sites on the same server. For example DEV and QA. In this case I would structure it as:

c:\inetpub\dev\site1
c:\inetpub\dev\site2

c:\inetpub\qa\site1
c:\inetpub\qa\site2

Solution 2 - asp.net

As variant:

C:\WebSites\my.site1.com

C:\WebSites\my.site2.com

Solution 3 - asp.net

if you prefer you can put your application folder on desktop of your server. It is really up to you. You just need to make the proper configurations inside IIS and grant necessary access permissions to your folder. That's all.

Solution 4 - asp.net

There is no definitive answer but

  • C:\inetpub\wwwroot\Website1\
  • C:\inetpub\wwwroot\Website2\

are the standard locations for web sites. For example c:\inetpub\ftproot could be used to host an FTP site.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionJonathan WilliamsView Question on Stackoverflow
Solution 1 - asp.netNotMeView Answer on Stackoverflow
Solution 2 - asp.netAnkarView Answer on Stackoverflow
Solution 3 - asp.nettugberkView Answer on Stackoverflow
Solution 4 - asp.netDarin DimitrovView Answer on Stackoverflow