Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

like image 679
Jonathan Williams Avatar asked Sep 23 '11 13:09

Jonathan Williams


People also ask

What should be in the wwwroot folder?

The wwwroot folder is new in ASP.NET 5 to store all of the static files in your project. Any files including HTML files, CSS files, image files, and JavaScript files which are sent to the user's browser should be stored inside this folder.

What is wwwroot folder in asp net?

By default, the wwwroot folder in the ASP.NET Core project is treated as a web root folder. Static files can be stored in any folder under the web root and accessed with a relative path to that root.

What is wwwroot lib for?

New in ASP.NET Core projects is the existence of the wwwroot/lib folder, which holds collections of static files (CSS, JS, images) from front-end packages.

Can I delete Inetpub folder?

When the computer is not supposed to be used as a web server, you can delete Inetpub folder. Especially when this is causing some issues or you don't want to risk any of the vulnerabilities. This folder is useless and you can definitely delete it if you are not using the IIS or hosting websites on the computer.


2 Answers

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

like image 197
NotMe Avatar answered Sep 23 '22 06:09

NotMe


As variant:

C:\WebSites\my.site1.com

C:\WebSites\my.site2.com

like image 24
Ankar Avatar answered Sep 22 '22 06:09

Ankar