Multisites Solution in Single Sitecore Instance

Sitecore is designed to be able to host multiple websites within one instance. But in real development world, websites are very different from both business requirement and technical design. They can be built in totally different directions, such as MVC vs webform, GlassMapper, IoC, etc. The question is, how can they be deployed to same web root without conflicts and what is the best development environment in Visual Studio?

Actually we can create all sites in one MVC projects with areas to separate them. But the problem is, any code behind change will cause all sites required regression test and maintenance is a nightmare.

So I suggest to create all sites in separate projects. Here are highlights of the key practices.

  1. Each site/application should have separate layers in Business, Data, Presentation, Service and TDS based on requirement and design.
  2. All front-end sites/components should be bucketed under folder “Presentation” with {global.asax} and {web.config} removed.
  3. All front-end sites/components should be built in MVC with area. Be sure not to create conflict area name.
  4. Configurations should be put into its own folder and included in App_config. Never modify web.config.
  5. All processes which happen during application start are centralized in one MVC project. In this project there is a class “CommonRegistration” which the processes should be added into, such as special route registration, IoC container registration, etc.
  6. A pipeline config file should be created for Sitecore to initialize these processes when application starts. For example, \App_Config\Include\z-Sites\CommonInitializer\SitesCommonInitialize.config
  7. As Sitecore has a pre-loaded area “Social”, so area registration can’t go into initializer and has to stay in global.asax under the initializer project.

Sitecore Multisites Solution Diag

This entry was posted in Information Technology, Sitecore and tagged , , , . Bookmark the permalink.

3 Responses to Multisites Solution in Single Sitecore Instance

  1. Nathan says:

    what about debugging…
    Obviously we are going to use Visual Studio as the development environment then what will happen to debugging when different pieces of projects are sitting here and there. I know we have remote debugging facility but still setting them up every time we develop a project it will be a nightmare.

    • wenronglexin says:

      Hi Nathan. This is exactly a Visual Studio code solution which support multi-sites in Sitecore single instance. Basically each website is a MVC project in presentation section, see the diagram. It uses MVC “Area” concept to separate each site controller/model/view. When you debug the code, just go to Visual Studio debug menu and select “Attach to Process”, then find all “w3swp.exe” and attach them. Then you are on the way…

  2. Pingback: Understand the Challenges of Multisites on Single Sitecore Instance | A coffee in sunny winter afternoon

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s