1

I have 50 SAME asp.net websites hosted on IIS. Something like WordPress, where each website though same has different content.

C:\inetpub\vhosts\website1.com    
C:\inetpub\vhosts\website2.com
C:\inetpub\vhosts\website3.com
.    
.    
.    
C:\inetpub\vhosts\website50.com

Since these are exactly same copies of the ASP.NET website; I want to use a 'common' bin folder so that I don't load 50 copies of the same set of DLLs to update and load in memory each time.

The solutions here: Is there a way to change .net mvc bin dir location? DO NOT work as I want the DLLs to be placed outside the website folder, so that they can be shared.

garyh
  • 2,782
  • 1
  • 26
  • 28
swapsshah
  • 37
  • 4

1 Answers1

2

One little detail you should know about IIS and ASP.NET; they do not actually run the files in the bin folder. Rather, they copy the files in the bin folder into a "shadow directory" (something like "C:\WINDOWS\Microsoft.NET\Framework\v4.5.XXXX\Temporary ASP.NET Files"). It is from there that they are actually executed. The bin folder is monitored for any changes, and the shadow directory is updated as needed. This allows you to deploy new DLLs even when the site is running-- otherwise, they'd be locked.

So... no matter what you do, the O/S is going to load multiple images of the same DLL, even if you get them to all use the same bin folder. As far as I know there is no way to turn this off.

That being said, if you want to save a bit of disk space and get your sites to use a common bin folder, consider using a symbolic link. This essentially allows you to create a directory that "points" at another directory (this sort of thing is more common in Unix). Thus you end up with one copy being accessed from several places. Just one word of caution: be very careful when deleting things, because you could delete folders from all 50 of your sites without meaning to.

But a better option (depending on why you are running 50 identical sites, which is very unusual) is to run just ONE site, with one IP address, but with several DNS entries pointed at that IP. This way it would look like you have 50 sites when you only have one. The trick here is (if you are using https) you'll have to use host headers to pick the SSL cert so that browsers don't show a phishing warning. Or, if your site is load balanced, you could terminate SSL at the load balancer (a strategy known as SSL offloading) so that a cert at the IIS level isn't even needed.

John Wu
  • 50,556
  • 8
  • 44
  • 80