We've just gone live with our first site on a Enterprise license running EpiServer CMS 5 R2 Sp1.
We're getting an issues where every so often the site's IIS application gets initialized with the wrong siteid, leading to the error:Application is initialized with settings for siteId=X, but current request maps to siteId=Y.
To clarify id X is the site that has the wildcard sitehost (<add name="*" />), while id Y is the site that the hostnames in the live app's IIS hostheader settings should match.
The above exception we get is thrown by EPiServer.Configuration.Settings class (line 173).
My plan is to try and use Log4Net to log the value of HttpContext.Current.Request.Url when the app is initalising, to see why sometimes it does not match the sitehost values in our enterprise config file.
Can anyone suggest how I could either capture an event to log this. Alternately, can I add a parameter to Log4Net's SQL appender that would show this value?
For now we've resolved the issue by configuring the live application to also contain the wildcard sitehost, so irrespective of the url present during app initialization, it will still initalize the correct site. This is obviusly only going to work until we go live with the next site (soon).
Any help would be highly appreciated.
I also got the problem with CMS 6 and a enterprise site, I changed the automaticSiteMappings in EPiServerFramwork.config to fix it.
<automaticSiteMapping> <add key="/LM/W3SVC/5/ROOT:COMPUTER" siteId="site1.com" /> <add key="/LM/W3SVC/6/ROOT:COMPUTER" siteId="site1.com" /> </automaticSiteMapping>
So both my sites was mapped to my first site. I had to change the second line to my second site:
<automaticSiteMapping> <add key="/LM/W3SVC/5/ROOT:COMPUTER" siteId="site1.com" /> <add key="/LM/W3SVC/6/ROOT:COMPUTER" siteId="site2.com" /> </automaticSiteMapping>
And it worked!
thank you for this solution. That works for us too.
We are using EpiServer CMS 7 version, in that we need to create the multi-sites, so we followed the basic steps and changed the automaticSiteMappings in EPiServerFramwork.config. After that we are getting the below error. Any help in advance really helpful.
Application is initialized with settings for siteId="site1.com", but current request maps to siteId="site2.com"
Check you IIS bindings and make sure that the site1 doesn't have a binding for site2's url.
You need to have one IIS site for each site you have set up.
Thank you for the quick reply.
It's working now, but we are getting other problem likes below.
After creating the two different website the names are displayed in the top menu (Please refer the screenshot below)
We are selecting child page under the start page in the tree and we want to view the child page in preview mode. But, when we click the display menu (as attached above) it shows the start page in the preview mode instead of showing the current selected page
Please share your thought.