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

47,375

Solution 1

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

As variant:

C:\WebSites\my.site1.com

C:\WebSites\my.site2.com

Share:
47,375
Jonathan Williams
Author by

Jonathan Williams

Certified SDL Web (Tridion) Architect and Developer with over fifteen years of SDL Tridion experience on 40+ implementations. SDL Tridion MVP (2014 onwards) Co-founder at UK based, SDL Tridion Partner Stage Two (UK) Ltd. (https://wearestagetwo.com). Website: https://wearestagetwo.com Blog: http://wearestagetwo.com/blog Twitter: https://twitter.com/wearestagetwo Twitter (personal): https://twitter.com/_JWilliams LinkedIn: https://www.linkedin.com/in/jonathan-andrew-williams

Updated on September 24, 2020

Comments

  • Jonathan Williams
    Jonathan Williams over 3 years

    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

  • Jonathan Williams
    Jonathan Williams over 12 years
    Thanks Chris. Yes, I suspected that this was the case. I have created my website folders inside of the inetpub folder.
  • simbolo
    simbolo almost 9 years
    The wwwroot folder is the default website that contains the IIS welcome homepage. Anything you place into this, will be accessible if you visit the server via it's IP address, or a binding the server doesn't recognise. Placing websites here is not recommended, place your website directory alongside this root folder, not inside it.
  • DJIDave
    DJIDave over 7 years
    I would stay away from this option as the desktop is linked to a single user (the folder tends to be under user settings on the machine) so removal of that user would break your website. I do understand the point of the post is "You can put it anywhere" but this is a bad exampl
  • mchar
    mchar almost 4 years
    Make sure to assign the proper permissions to any new created directory, as those assigned to the wwwroot before deleting it.