Posts tagged multitenancy
Posts tagged multitenancy
0 notes &
I don’t know if it’s positive or negative, but certainly worth knowing if you’re working with the OrchardCMS Multitenancy module:
A different instance of the ISingletonDependency is created for each tenant.
4 notes &
I ran into a few issues working with the Multitenancy Module in Orchard CMS:
Setting up a development environment using IIS
First of all there’s just one site running on my server, but it needs to be reached by multiple domains. For instance, http://localhost should go to my default site, and http://tenant should go to the tenant site. To get this working in IIS, edit the Hosts file (c:\Windows\System32\drivers\etc\hosts) and add:
127.0.0.1 localhost
127.0.0.1 tenant
When you surf to http://tenant, this file tells your machine to go to 127.0.0.1 instead of look the domain up on the internet.
Deleting tenants
When you create a tenant, a new folder gets created in the AppData/Sites directory. Next to the existing Default site.
The tenants are retrieved by the function ShellSettingsManager.LoadSettings(). This function checks the AppData/Sites folder for folders containing a Settings.txt file. So if you’re running into problems with your tenant, it’s easy to remove it again by removing the directory.
Custom named Routes
When it was working, I immediately got this error message:
A route named 'LocationDetails' is already in the route collection. Route names must be unique.
Parameter name: name
And more disturbingly, the error message was also shown on my default site! First thing to do is remove the tenant directory from AppData/Sites, so the default site builds again. Then find out wtf is happening!
Apparantly there’s one MVC RouteTable in memory. So when a module registers a route, it also gets registered for each tenant that has the module enabled. The problem here is that I was adding named routes to the RouteTable. By simple removing the “Name = “LocationDetails”“, both sites were working again, both enabling my LocationDetailsModule.
Wrap-up
I’m going to use the multitenancy module to host 7 different languages of the same site, each on its own domain name. With this module I can have 1 codebase and configure each site to behave slightly different. If I run into any other problems, you’ll be the first to hear :)