SharePoint Internals: Clearing Configuration Cache Caveat

I’m pretty sure most of you have heard of the SharePoint Cache. This is a directory full of cached objects, nicely wrapped in XML. Sometimes however this cache can become corrupted. A great example of this occurs when developing SPJobDefinitions (TimerJobs for SharePoint). These definitions use this cache, so everytime you deploy new versions of the assemblies, you’ll have to clear the cache. More info about this:

Clearing the cache, means deleting all the XML files. But what if you delete the entire directory? Well, it gets messy.. ;-) SharePoint TimerJobs just stop working all together. And to top it off, you get these nice error messages:

SPTimerStore.InitializeTimer: SPConfigurationDatabase.RefreshCache returned SPConstants.InvalidRowVersion 
The timer service could not initialize its configuration, please check the configuration database.  Will retry later.

Great! :p

So what happened? The directory in question is: C:\Documents and Settings\All Users\Application Data\Microsoft\SharePoint\Config\<guid>\. So the name of the directory is some kind of identifier. Looks pretty innocent, huh..  it isn’t!
When this happened to me earlier on today, I wasn’t really feeling at ease. The timerjobs didn’t want to run, and no one seemed to know what this guid was. After a few hours of reverse engineering however, I found discovered this was actually the config DB ID. Nice! But where can I find it? Luckily it was not hard to find out. You’ll have to open up the registry and go to: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\12.0\Secure\ConfigDB

The config DB registry key.

The config DB registry key.

In this key, you’ll find the config DB id. Now all you have to do, is create a directory with this guid and restart the SharePoint Timer service. And you’ll see your XML files reappearing, and soon after your timerjobs restarting. Phuw, that was a close one.. :-)

’till next time!

Leave a Reply