This project is read-only.

Restoring working multi-tenant > local... all sites route to default tenant

Topics: Customizing Orchard, Installing Orchard, Troubleshooting
Dec 18, 2014 at 12:16 PM
Currently running 1.7.1 and in an effort to update to the latest version, I'm trying to restore my environment that's currently running in Azure => local so I can test the upgrade process. In production I have a single website that hosts Orchard, one DB for the default tenant & another DB that hosts three other tenants.

I restored everything (codebase & two DBs) locally to a Windows 2012 Server, updated all tenant settings files to point to the local databases, created an IIS site that points to the webroot of my local instance with three host header bindings (for the four tenants... default + three others). Then I updated my HOSTS file to have all domains point to localhost ( To be sure it was running 100% locally, I killed my network connection.

When I browse to the default tenant, it works as expected. However, when I browse to the other tenants, Orchard renders them like they are the default tenant (the only difference is the domain name). There are no errors... I just can't get the non-default tenants to come up locally... instead the default tenant comes up. The observed behavior is that the multi-tenant "pipeline" is not picking up the domain requested and serving up the correct tenant.

I'm not suggesting this is an Orchard bug, more that it's a config on my side... can't figure out how to get the tenants working locally. I've looked at these instructions ( but the routing for the domains part is handled with HOSTS & IIS settings since I'm on Windows Server.

I searched the forum & stack overflow and can't find another instance of someone having this same issue... ideas?
Dec 18, 2014 at 1:05 PM
Something similar happened to me before, and it was due to me putting the tenant folders not in the "Sites" folder, but one level too high. Silly mistake which you probably didn't make yourself, but what I did to figure it out was by simply following the code execution with a debugger attached. It's a sure way to find where you went wrong.
Dec 18, 2014 at 1:22 PM
Unfortunately I don't think that's it... I cloned the production codebase => local exactly as is (in fact I am using local git in Azure for deployment so I just did a git clone of my production site to local). I'm no junior dev, but it's hard to follow the code execution from the start in Orchard as it's so dynamic. Where would you suggest I start with the debugger attached for trying to see what the issue is?
Dec 18, 2014 at 1:37 PM
Edited Dec 18, 2014 at 1:38 PM
I'll admit it can be tricky at times, but in this case the path seems pretty linear when you start in the CreateAndActivateShells method of the DefaultOrchardHost class and stepping into LoadSettings:
// is there any tenant right now ?
var allSettings = _shellSettingsManager.LoadSettings().ToArray();
Very curious to hear what the issue was.
Dec 18, 2014 at 2:11 PM
Cool... I'll give that a shot. On another project today so I'll get back into this tomorrow AM. I'll report back what I find (or don't find) :)