Try our conversational search powered by Generative AI!

Logging url during app initialization - problem with enterprise site initializing with wrong site id.

Vote:
 

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.

 

#32054
Aug 20, 2009 15:32
Vote:
 

I also got the problem with CMS 6 and a enterprise site, I changed the automaticSiteMappings in EPiServerFramwork.config to fix it.

It had

  <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!

#44113
Edited, Oct 01, 2010 8:45
Vote:
 

thank you for this solution. That works for us too.

#50009
Apr 08, 2011 13:17
Vote:
 

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"

 

 

#73383
Edited, Jul 17, 2013 9:29
Vote:
 

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.

#73385
Jul 17, 2013 9:38
Vote:
 

Hi Toni,

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)

 

 

Scenario:

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.

 

#73388
Jul 17, 2013 11:31
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.