Old Site

This site is archived. I now update and maintain my blog here.

Working around the 'no nodes' issue with Umbraco 4.5.x

Updated: I've added some code to the snippet below to see if you have an empty cache before doing the republish.

A while back I ran into an issue where this site would regularly go off line and revert to the Umbraco "no nodes" splash page that you usually get post install.

As the forum thread explains this seems to be an issue introduced in Umbraco 4.5.x where the content cache can't be created on startup if SQL server is unavailable (I presume it just fell back to the old cache in previous versions). I was getting the issue on a regular basis as my hosting provider had enabled my server to auto restart after installing windows updates. When the server started up there was a race condition between the SQL server and IIS services - more often than not IIS would start first and SQL would not be available.

The solution was to Republish the cache manually via the Umbraco GUI once all services were up. Not wanting to have to do this every time I delved into the source and found the following code.

Server.ScriptTimeout = 100000;
var cacheFile = IOHelper.MapPath("~/App_Data/umbraco.config");
var r = XmlReader.Create(cacheFile, new XmlReaderSettings() { DtdProcessing = DtdProcessing.Ignore });
var d = new XmlDocument();

var n = d.SelectSingleNode("//root");
if (n.ChildNodes.Count != 0) return;


So, rather than do the republish manually every time the issue occurs, I've replaced the out of the box noNodes.aspx with a page that executes the code above and does a redirect to the referer.

The correct solution of course would to be able to control the order in which services on the server come up. But this may suffice as a nice little workaround for any of you experiencing the same problems.


Leave a comment