February 17, 2012

Team development for sitecore (TDS) - Double build required

With Team development for sitecore (TDS) some developers of my company complain that they need to build the solution twice to have they change in the deploy folder.

After some investigations, I have found that sometime TDS doesn't create the dependencies correctly. And, with those dependencies not correctly set the TDS project is build before the project to deploy.

The bug fix is pretty easy:
  1. Right click on your solution and then on "properties"
  2. Click on the "Project Dependencies"
  3. In the "project" dropdown select your project to deploy and uncheck the corresponding TDS project
  4. In the "project" dropdown select your TDS project to deploy and check the corresponding project to deploy

February 15, 2012

Config patching system for the external config files

This very good post http://www.thescrewballdivision.com/playing-with-sitecore-include-files explain the available commands for the patching very well so I will not copy it but I will add an important information.

When you need to add some informations in a tag the key used for the merge is the property name.

Example:

By default in the web.config you have this:
<event name="publish:end">
 <handler type="Sitecore.Publishing.HtmlCacheClearer, Sitecore.Kernel" method="ClearCache">
   <sites hint="list">    
      <site>website</site>
   </sites>
 </handler>
</event> 

And if you add this in a separated config file:
<event name="publish:end">
 <handler type="Sitecore.Publishing.HtmlCacheClearer, Sitecore.Kernel" method="ClearCache">
   <sites hint="list">    
     <site>mysite</site>
   </sites>
 </handler>
</event> 

The merged web.config will be:
<event name="publish:end">
 <handler type="Sitecore.Publishing.HtmlCacheClearer, Sitecore.Kernel" method="ClearCache">
   <sites hint="list">    
      <site>mysite</site>
   </sites>
 </handler>
</event> 

To avoid this and combine the two tags without removing the existing one you only have to add a name property in the site tag:
<event name="publish:end">
 <handler type="Sitecore.Publishing.HtmlCacheClearer, Sitecore.Kernel" method="ClearCache">
   <sites hint="list">    
      <site name="mysite">mysite</site>
   </sites>
 </handler>
</event> 

Like this you will have the expected result:
<event name="publish:end">
 <handler type="Sitecore.Publishing.HtmlCacheClearer, Sitecore.Kernel" method="ClearCache">
   <sites hint="list">  
      <site>website</site>
      <site name="mysite">mysite</site>
   </sites>
 </handler>
</event> 

February 9, 2012

Error message - The operation could not be completed

I post here an error message I had yesterday on the sitecore of one of our customer because I don't have found this answer on the sdn site of in the forums.

We had randomly some error messages:
"The operation could not be completed.

Your session may have been lost due to a time-out or a server failure.

Try again."
After investigation, I don't have found any error messages in the logs or in the windows event viewer. But, we had multiple log files with the same datetime.

In fact the resolution was pretty simple the number of worker process of the application pool was set to 5 but it must be set to 1.

To change it:
  1. In iis select your application pool and click on the "Advanced settings" button
  2. In the "Process Model" section, set the "Maximum Worker Process" to 1.

February 7, 2012

Share the config file : how to handle the path like the dataFolder

When we use SVN or TFS normally we commit some .config file an especially the web.config. The problem happened when all the computers doesn’t have the same path structure. For example I will not use the same data folder as my colleague.

You have multiple solutions to handle including having different build configuration but I think that the easiest way to handle it is by simply using the virtual directories.

To create a virtual directory:
  1. In IIS right click on your website and select “Add Virtual Directory”
  2. The alias is the folder name (in your config file) and the physical path is the real folder
  3. In the config, the datafolder will look like
      <sc.variable name="dataFolder" value="/Data" />
      

February 6, 2012

Remote events how to investigate

I had some issues with the sitecore remote events not triggered on the content delivery. I will explain how you can investigate why it could happened and how to fix it.


First of all, how sitecore handle the remote events when you use the scalability?


When you publish an item in sitecore, sitecore will write a line in the EventQueue table of the corresponding database with all the necessary data including the InstanceName of the server who have triggered the event.

After that sitecore have an timer who check in this table if they are any event to trigger. First remark, sitecore look at the InstanceName field to know if this instance need to trigger this record or not so this instance need to be unique (be carefull with the copy paste) ;-).


Here is what sitecore add in the web database in the EventQueue when you publish an item:
Id 82480059-8CF4-4D2E-82B1-9C00323F12F2
EventType Sitecore.Eventing.Remote.PublishEndRemoteEvent, Sitecore.Kernel, Version=6.0.0.0, Culture=neutral, PublicKeyToken=null
InstanceType Sitecore.Eventing.Remote.PublishEndRemoteEvent, Sitecore.Kernel, Version=6.0.0.0, Culture=neutral, PublicKeyToken=null
InstanceData {"CompareRevisions":true,"Deep":false,"FromDate":"\/Date(-5339901827822+0200)\/","LanguageName":"en","Mode":3,"PublishDate":"\/Date(1328532964271+0100)\/","PublishingTargets":["{8E080626-DDC3-4EF4-A1D1-F0BE4A200254}","{8E080626-DDC3-4EF4-A1D1-F0BE4A200254}"],"RepublishAll":false,"RootItemId":"ebff6e2a-9149-4660-9d55-dec34282f856","SourceDatabaseName":"master","TargetDatabaseName":"web"}
InstanceName GRNQ6R1-sitecore650up3
RaiseLocally 0
RaiseGlobally 1
UserName sitecore\admin
Stamp 0x0000000000079C0F
Created 2012-02-06 12:56:07.033


The most important columns are :
  • "InstanceName": it is the server who have triggered the event. (setting "InstanceName" from ScalabilitySettings.config)
  • "EventType": The type of event: item:saved:remote, publish:end:remote, ...
  • "InstanceData": The data required to perform this operation

This is the first method to see if your events are trigered.

For the second method, you need to set in the web.config of each server the <events timingLevel="high"> setting (this setting is set to custom by default).
With this modification you should have any line like this for each event handled by sitecore in your log on both content delivery and content management instances.
Heartbeat 14:22:05 INFO  Event started: publish:statusUpdated
Heartbeat 14:22:05 INFO  Executed: Sitecore.Publishing.RemotePublishingEventHandler.OnStatusUpdated(). Elapsed: 4,23265309264199
Heartbeat 14:22:05 INFO  Event ended: publish:statusUpdated. Elapsed: 4,33442834380877

If even with all those informations your events are not triggered or triggered but not received in by the other server you can try to cleanup the temporary event tables.
On each database execute those scripts:
DELETE FROM EventQueue;
DELETE FROM [Properties] WHERE  [Key] LIKE 'EQStamp%';

I don't know exactly what is the EQStamp% setting but it was the solution provided by the support and it has solved my problem :) If anybody know what is is exactly you can post a comment.

Be also careful to the exception in your events because if one event of the pipeline throw an exception the other one will be not executed.