Sitecore Push Session errors
I had a recent issue where i had a Sitecore environment with one Content Management (CM) Server and two Content Delivery (CD) servers and my CD servers were having issues with the Analytics.
I was getting the following errors in the Sitecore log file:
ManagedPoolThread #2 00:11:03 INFO Job ended: Sitecore.Tasks.UrlAgent (units processed: ) 2336 00:13:56 ERROR Cannot push session url: http://www.website.com.au/sitecore/service/analytics/session/PushSession.ashx
2336 00:13:56 ERROR Cannot create tracker. Exception: System.Net.WebException Message: The remote server returned an error: (404) Not Found.
2336 00:13:56 ERROR Cannot start analytics. Exception: System.InvalidOperationException Message: Tracker.Current is not initialized
It turns out it was a silly error on my part. This site had a different hostname before it went live (i.e. test.website.com) and then when we switched the values in IIS and Sitecore to a new hostname. What wasn’t changed across was the Hosts file on each CD Server (located in C:\Windows\System32\drivers\etc\).
Sitecore will update this file when it is first installed to include the Sitecore instance name; when additional bindings are added later on (e.g. for testing purposes, subsites or microsites) you will need to manually update the IIS bindings, the host file, and the configuration of Sitecore hostnames in your config files.
e.g.
127.0.0.1 SitecoreInstanceName
127.0.0.1 website.com.au
127.0.0.1 test.website.com.au
How to setup multiple subsites in Sitecore’s config files will be covered in a future post.