How can I setup One codebase for many Web Sites? RRS feed

  • Question


    How can I setup One codebase for many Web Sites?


    Trying to get ideas of how to do this....


    The situation that I have would be just to find a way to point to different databases.


    The current situation is to duplicate the code base having the web config point to the different databases. I would like to eliminate the duplication of code base and have only one code base, but then how to solve the problem of configuring the unique web.config??


    Thanks in advance for any input.

    Friday, July 18, 2008 4:20 PM

All replies

  • Having different web.config file does not mean different code base.  That is the beauty of abstracting information in a configuration file so it can vary and the code base stays the same...  Or am I missing something from your problem?

    Friday, July 18, 2008 5:27 PM
  • Thanks GajaKannan for your reply.


    What I trying to know is if it is possible to have many web sites pointing to a single directory location in the IIS and what would be the implications of having to configure the web.config pointing to different databases.


    Or if someone would have the experince of dealing with this kind of situation.



    Friday, July 18, 2008 6:12 PM
  • Look at virtual directories in IIS
    Friday, July 18, 2008 9:37 PM
  • Any other suggestions?

    Saturday, July 19, 2008 2:07 AM
  • Virtual Directories will allow you to have one code base and multiple web.configs, is there more that you need or don't you have access to setting them up?

    Saturday, July 19, 2008 7:28 AM
  • How is that going to work?


    The current situation that I have is:


    1. I have set one Virtual Directory for each client with its own web.config pointing to a corresponding database and the corresponding folder with the client code.


    How can I get an alternative solution to the above situation?

    I would like not have to duplicate the corresponding folder with the client code, but if I have many clients pointing to the same folder with the client code, how to solve the problem of having just one web.config for many clients?






    Saturday, July 19, 2008 11:43 AM
  • No, the other way around. You have multiple web sites for each client, and the code base is a virtual folder in them pointing to a single location on disk with the dlls in them. Failing that you can add code probing locations into each config file.


    Saturday, July 19, 2008 2:36 PM
  • Thank you very much pkr2000 for your time and feedback.


    Could you please explain a little more at low level detail, if it is possible would you have some sample code?


    I could not understand clearly your last e-mail.






    Sunday, July 20, 2008 2:36 AM
  • When I get a bit of time I'll give it a try to see if it works, but basically the idea is something like;

    Virtual Directory...
    = MyBinaries

    Real sites....

    re: Code Probing, you could put probing hints into the web configs to direct the binder to a common folder structure, e.g. C:\Bla\MyBinaries

    Sunday, July 20, 2008 8:35 AM
  • Thanks again pkr2000,


    It is still not clear to me how this would work.

    Sorry, if I have been a pain, but I am used to setting  all clients under the default Web Site in IIS.


    When you have a situation that you have designed above, I would have to:


    1.Create first the Virtual Directory Binaries pointing to the physical location C\Bla\MyBinaries

    Where should I create this? In the Default Web Site would work?

    2.Create 1 Web Site for each client:


    Real sites....



    Point each site to the physical location C\Bla\MyBinaries?


    3. re: Code Probing, you could put probing hints into the web configs to direct the binder to a common folder structure, e.g. C:\Bla\MyBinaries


    Not clear what you mean by putting probing hints int web configs.


    Would not the web.config be under C\Bla\MyBinaries/


    Thank you in advance.




    Saturday, July 26, 2008 1:38 PM
  • Sorry I've not had time to try it on a full blown IIS yet, but here is the info about changing the code probing...

    Saturday, July 26, 2008 7:26 PM
  • Does anyone else have tried this in IIS 6.0?


    Thanks in advance.


    Friday, August 1, 2008 2:31 AM
  • Finally got it working!


    1. The virtual folders didn't work, the code probing doesn't go via the web so it just ignored it.

    2. Then I tried creating a "fake" folder from my site to the location of the binaries using a hardlink. That almost worked but .net complained when attempting to load the binary that the name wasn't correct (drat).

    3. I then tried creating the actual bin fiolder but hard-linking each file in it, YES that worked a treat.


    Example command line...

    fsutil hardlink create "C:\Projects\Scratch\WebFolder\bin\WebApplicationTestFolders.dll" "C:\Projects\Scratch\WebApplicationTestFolders\WebApplicationTestFolders\bin\WebApplicationTestFolders.dll"


    I.e. the dll only exists in the WebApplicationTestFolders..bin folder but I'm re-using it in the WebFolder site by using the Windows version of a symbolic link, or faking the file.



    Friday, August 1, 2008 8:38 AM