Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Darren Ferguson 1022 posts 3259 karma points MVP c-trib
    Oct 18, 2010 @ 10:46
    Darren Ferguson
    0

    Site repeatedly reverting to no nodes splash page

    Hi All,

    I am running Umbraco 4.5.2 on Windows Server 2008 R2 and SQL Server 2008 R2 using .net 4 and IIS 7.

    I have an issue where my site repeatedly reverts to the Umbraco 'No nodes' splash page.

    I checked the Umbraco log table and the system event logs and didn't discover anything.

    I have elmah installed and I seem to be getting a lot of the following two exceptions:

    System.Data.SqlClient.SqlException: Cannot open database "xxxxxx" requested by the login. The login failed. Login failed for user 'xxxxxx'.

    System.Data.SqlClient.SqlException: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.

    I've verified the SQL server conncetion details in my web.config and they are correct.

    To me this all suggests that occasionally Umbraco can't connect to SQL server - probably an issue with the VPS host that I am using being not so good (again). The SQL server is installed in the same VM as IIS BTW.

    Anyway - my question is. In what situation would Umbraco attempt to rebuild umbraco.config during the normal request cycle? These errors all occur when no-one is using the back office and performing any updates of content. Where and how could a database connection error cause umbraco.config to be unavailable?

    I've looked in the logs and the above error messages don't coincide with application startups in the umbracoLog table. As I understand it Umbraco should be resilient in the sense that pages are rendered from umbraco.config which is created at app startup and modified when users perform certain operations in the back office.

    Many Thanks for any suggestions.



  • Darren Ferguson 1022 posts 3259 karma points MVP c-trib
    Oct 18, 2010 @ 10:51
    Darren Ferguson
    0

    Duh: This helps doesn't it :) I'll have a dig around in the code but if anyone has any ideas.....

    System.Web.HttpUnhandledException (0x80004005): Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> umbraco.DataLayer.SqlHelperException: Umbraco Exception (DataLayer): SQL helper exception in ExecuteReader ---> System.Data.SqlClient.SqlException: Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.
       at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
       at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning()
       at System.Data.SqlClient.TdsParserStateObject.ReadSniError(TdsParserStateObject stateObj, UInt32 error)
       at System.Data.SqlClient.TdsParserStateObject.ReadSni(DbAsyncResult asyncResult, TdsParserStateObject stateObj)
       at System.Data.SqlClient.TdsParserStateObject.ReadNetworkPacket()
       at System.Data.SqlClient.TdsParserStateObject.ReadByte()
       at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
       at System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean enlistOK)
       at System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo serverInfo, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, TimeoutTimer timeout)
       at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, TimeoutTimer timeout, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance)
       at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance)
       at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection)
       at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options)
       at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject)
       at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject)
       at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject)
       at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
       at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
       at System.Data.SqlClient.SqlConnection.Open()
       at Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteReader(String connectionString, CommandType commandType, String commandText, SqlParameter[] commandParameters)
       at umbraco.DataLayer.SqlHelpers.SqlServer.SqlServerHelper.ExecuteReader(String commandText, SqlParameter[] parameters)
       at umbraco.DataLayer.SqlHelper`1.ExecuteReader(String commandText, IParameter[] parameters)
       --- End of inner exception stack trace ---
       at umbraco.DataLayer.SqlHelper`1.ExecuteReader(String commandText, IParameter[] parameters)
       at umbraco.cms.businesslogic.web.Domain.<GetDomains>b__0()
       at umbraco.cms.businesslogic.cache.Cache.GetCacheItem[TT](String cacheKey, Object syncLock, CacheItemPriority priority, CacheItemRemovedCallback refreshAction, CacheDependency cacheDependency, TimeSpan timeout, GetCacheItemDelegate`1 getCacheItem)
       at umbraco.cms.businesslogic.cache.Cache.GetCacheItem[TT](String cacheKey, Object syncLock, CacheItemPriority priority, CacheItemRemovedCallback refreshAction, TimeSpan timeout, GetCacheItemDelegate`1 getCacheItem)
       at umbraco.cms.businesslogic.cache.Cache.GetCacheItem[TT](String cacheKey, Object syncLock, CacheItemRemovedCallback refreshAction, TimeSpan timeout, GetCacheItemDelegate`1 getCacheItem)
       at umbraco.cms.businesslogic.cache.Cache.GetCacheItem[TT](String cacheKey, Object syncLock, TimeSpan timeout, GetCacheItemDelegate`1 getCacheItem)
       at umbraco.cms.businesslogic.web.Domain.GetDomains()
       at umbraco.cms.businesslogic.web.Domain.GetDomain(String DomainName)
       at umbraco.cms.businesslogic.web.Domain.Exists(String DomainName)
       at umbraco.requestHandler.CreateXPathQuery(String url, Boolean checkDomain)
       at umbraco.requestHandler..ctor(XmlDocument umbracoContent, String url)
       at umbraco.UmbracoDefault.Page_PreInit(Object sender, EventArgs e)
       at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e)
       at System.EventHandler.Invoke(Object sender, EventArgs e)
       at System.Web.UI.Page.PerformPreInit()
       at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
       at System.Web.UI.Page.HandleError(Exception e)
       at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
       at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
       at System.Web.UI.Page.ProcessRequest()
       at System.Web.UI.Page.ProcessRequest(HttpContext context)
       at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
       at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
    
  • Matt Brailsford 4124 posts 22215 karma points MVP 9x c-trib
    Oct 18, 2010 @ 10:55
    Matt Brailsford
    1

    Hi Darren,

    I've had the same problem on a couple of occasions myself which have usually happened, as you say, when the system hasn't been touched in a while. My thought would be that some timeout is being reached when Umbraco tries to connect to the DB (which has since wound itself down due to lack of use) and so gives up, and just shows the splash screen (this is all just my guess).

    I know it's not an actual solution, but one work-around for the time being, could be to use an uptime service like http://uptimerobot.com/ to constantly check your site, and thus, never let it close down.

    I'd still be interested in the actual solution mind, but this solution is usually good enough for me, and also has the added advantage of letting me know when a site is down.

    Matt

  • Morten Bock 1867 posts 2140 karma points MVP 2x admin c-trib
    Oct 18, 2010 @ 10:55
    Morten Bock
    0

    I have no solution to this, but experienced something similar. However this happened only once, in my case. So far my solution has been to set up a pingdom account to tell me if it happens again, and then I will investigate further. I was also under the impression that a missing sql connection _should_ not cause this, but I might be wrong.

  • Darren Ferguson 1022 posts 3259 karma points MVP c-trib
    Oct 18, 2010 @ 10:58
    Darren Ferguson
    0

    Morten, Pingdom doesn't help because the site is still up - just displaying a no nodes page.

  • Tom Maton 387 posts 660 karma points
    Oct 18, 2010 @ 11:01
    Tom Maton
    0

    Hi Darren,

    I've had this with my host a couple of times and it turned out that the reason I was getting the no-nodes splash screen was to do with the fact that the cache was always been cleared on my server.

    I only noticed this because I was having to republish the site again for it to work and not show the no nodes splash screen.

    Hope this helps

    Tom

     

  • Matt Brailsford 4124 posts 22215 karma points MVP 9x c-trib
    Oct 18, 2010 @ 11:01
    Matt Brailsford
    0

    Darren,

    I think you can get it to validate the occurance of a line of text, so you could check for a specific line of text in the page, but again, it doesn't really solve it.

    Matt

  • Darren Ferguson 1022 posts 3259 karma points MVP c-trib
    Oct 18, 2010 @ 11:05
    Darren Ferguson
    0

    I've downloaded the 4.5.2 release code and I'll dig around for a while.

  • Morten Bock 1867 posts 2140 karma points MVP 2x admin c-trib
    Oct 18, 2010 @ 23:36
    Morten Bock
    0

    Yup, like Matt said, it can look for a certain bit of text on the page. So if it does not show my footer (meaning it shows an error of some sort), then I will get notified. But again, it is only a solution to reducing the time it takes to react to the problem.

    Be interresting to hear if you find anything.

  • Darren Ferguson 1022 posts 3259 karma points MVP c-trib
    Oct 19, 2010 @ 09:56
    Darren Ferguson
    0

    @mat, @morten thanks for the tip about checking for a string in a page.

    I'll endeavour to resolve the issue and post here when I find out what is wrong.

  • jaygreasley 416 posts 403 karma points
    Oct 19, 2010 @ 11:01
    jaygreasley
    1

    On my laptop I have SQL Server set to manual start. Whenever I reboot and go to an umbraco site I get the splash screen.

    I can recreate this by

    1. Shut down SQL Server

    2. Shut down IIS

    3. Start IIS

    4. Start SQL Server

    Go to the Umb site and you *should* have the splash screen.

    So, my theory is that if the app pool recycles or the iis site goes down whilst it has lost it's connection to SQL you get the splash screen.

    Jay

  • Darren Ferguson 1022 posts 3259 karma points MVP c-trib
    Oct 19, 2010 @ 11:22
    Darren Ferguson
    0

    Good stuff.

    That is the theory that I was looking to prove too.

    I'm going through my event logs and I can see the VPS being rebooted. I'll go to my ISP and find out why.

    I guess that IIS is coming up before SQL server and hence the communication error.

    Still not sure why Umbraco doesn't fall back to the previous umbraco.config though.

     

  • Darren Ferguson 1022 posts 3259 karma points MVP c-trib
    Oct 19, 2010 @ 11:28
    Darren Ferguson
    0

    Ok - so my ISP has automatic updates enabled which allow Windows update to reboot the server.

  • David Farrell 2 posts 22 karma points
    Oct 19, 2010 @ 11:34
    David Farrell
    0

    We've been battling with this problem too and it's caused us much embarrassment with our clients. It always occurs when we reboot our hosting servers. The only way to get around it, we've found, is to switch off using the cache file (umbraco.config) on our production sites. This is not an ideal solution as you can imagine, but it's better than the embarrassing downtime we've suffered.

  • jaygreasley 416 posts 403 karma points
    Oct 19, 2010 @ 12:56
    jaygreasley
    1

    Yes, I tested the app pool theory and that doesn't appear to cause it, it has to be a full reboot.

    How about setting IIS to manual start and SQL Server to auto. Then set up a scheduled task (Powershell?) that checks to see if IIS is running (and SQL is running already) and if not starts it? This could run every minute. obviously it has some overhead but should be minimal.

  • Bill 81 posts 83 karma points
    Oct 19, 2010 @ 14:53
    Bill
    2

    So I guess we should change the noNodes.aspx page to show a more friendly -and less embarrassing- message to the visitor. Something to "We will be right back soon!"  I'm going to try to modify a projects's nonodes.aspx to send an email to the admin to alert him and to tell him to publish the site again.

  • Darren Ferguson 1022 posts 3259 karma points MVP c-trib
    Oct 19, 2010 @ 14:59
    Darren Ferguson
    0

    @bill good idea

  • Darren Ferguson 1022 posts 3259 karma points MVP c-trib
    Nov 02, 2010 @ 14:30
    Darren Ferguson
    0

    All - to workaround this I've added the following code to a custom noNodes.aspx page.

    Server.ScriptTimeout = 100000;
    Document.RePublishAll();
    library.RefreshContent();
    Response.Redirect("/");
  • Darren Ferguson 1022 posts 3259 karma points MVP c-trib
    Nov 02, 2010 @ 14:30
    Darren Ferguson
    0

    All - to workaround this I've added the following code to a custom noNodes.aspx page (it does a republish all).

    Server.ScriptTimeout = 100000;
    Document.RePublishAll();
    library.RefreshContent();
    Response.Redirect("/");
  • Darren Ferguson 1022 posts 3259 karma points MVP c-trib
    Nov 03, 2010 @ 12:18
    Darren Ferguson
    0
    var cacheFile = IOHelper.MapPath("~/App_Data/umbraco.config");
               
                var r = XmlReader.Create(cacheFile, new XmlReaderSettings() { DtdProcessing = DtdProcessing.Ignore });
                var d = new XmlDocument();
                d.Load(r);

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

    You can do the following to check if you have an empty cache before executing the code above.

     

  • Happyfanaticsalsero 59 posts 81 karma points
    Nov 05, 2010 @ 07:52
    Happyfanaticsalsero
    0

    I've been hit by the "no nodes" too today...

    Darren, I've also posted this question on your blog: how do I go about putting this custom no nodes page in place?

    Thanks in advance,

    /HFS

  • Darren Ferguson 1022 posts 3259 karma points MVP c-trib
    Nov 05, 2010 @ 11:06
    Darren Ferguson
    0

    @Happyfanaticsalsero what don't you understand? You just replace /config/splashes/noNodes.aspx with your own version that executes the code above.

     

     

  • Happyfanaticsalsero 59 posts 81 karma points
    Nov 05, 2010 @ 11:10
    Happyfanaticsalsero
    0

    OK, thanks. I just wasn't entirely sure. I'll post back with the result.

    /HFS

  • Connie DeCinko 931 posts 1160 karma points
    Nov 22, 2010 @ 16:24
    Connie DeCinko
    0

    Daren,  your code does not work since IOHelper cannot be found in the umbraco namespace.

     

  • Matt Brailsford 4124 posts 22215 karma points MVP 9x c-trib
    Nov 22, 2010 @ 16:30
    Matt Brailsford
    1

    Hi Connie,

    What version of Umbraco are you using? I think IOHelper was only introduced in v4.5x

    Many thanks

    Matt

  • Connie DeCinko 931 posts 1160 karma points
    Nov 22, 2010 @ 17:03
    Connie DeCinko
    0

    That was that problem.  I was reference 4.1 apparently.  So, next problem, code compiles and executes without error, but my cache is not being rebuilt.  I replaced my noNodes.aspx with a custom version and put the following in codebehind.  I copied the DLL to bin.  When the noNodes page is hit, I see my custom version, but the cache is not rebuilt.

    using System;
    using System.Xml;
    using umbraco;
    using umbraco.BusinessLogic;
    using umbraco.cms.businesslogic;
    using umbraco.cms.businesslogic.web;
    using umbraco.IO;


    namespace SBA.AZBar
    {
     public partial class noNodes : System.Web.UI.Page
     {
      protected void Page_Load(object sender, EventArgs e)
      {
       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(); d.Load(r);

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

       Document.RePublishAll();
       library.RefreshContent();
      }
     }
    }
  • Darren Ferguson 1022 posts 3259 karma points MVP c-trib
    Dec 22, 2010 @ 14:40
    Darren Ferguson
    0

    Apparently one can make windows services depend on each other.

    http://support.microsoft.com/kb/193888

     

  • Connie DeCinko 931 posts 1160 karma points
    Dec 22, 2010 @ 15:45
    Connie DeCinko
    0

    I don't think that will work when the SQL Service is on another server.

     

  • Darren Ferguson 1022 posts 3259 karma points MVP c-trib
    Dec 22, 2010 @ 16:09
    Darren Ferguson
    0

    No, it wouldn't.

  • Claire Botman 48 posts 77 karma points
    Feb 23, 2011 @ 05:38
    Claire Botman
    1

    Just incase anyone else is thinking they have to put Darren's code in the codebehind & mess around with dlls you don't have to.  Just replace the config/splashes/nonodes.aspx file with the Darren's code as follows:

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="noNodes.aspx.cs" Inherits="umbraco.presentation.config.splashes.noNodes" %>
    <%@ Import Namespace="umbraco" %>
    <%@ Import Namespace="System.Xml" %>
    <%@ Import Namespace="umbraco.cms.businesslogic.web" %>
    <%@ Import Namespace="umbraco.IO" %>

    <script runat="server">
    protected void Page_Load(object sender, EventArgs e)
    {
    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();
    d.Load(r);

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

    Document.RePublishAll();
    library.RefreshContent();
    Response.Redirect("/");
    }

    </script>

    Thankyou Darren this works great, but is it on codeplex?  It's a bit of a showstopper don't you think!

  • Paul Blair 466 posts 731 karma points
    Feb 23, 2011 @ 22:40
    Paul Blair
    0

    Hi,

    Just been experiencing the same issue. Out of interest were the people affected 1 week ago using SoftSys? They had a hardware fault and swapped out a SQL Server machine which caused this problem to occur on several of my sites.

    I just made a small change to Claire's code:

            if (n.ChildNodes.Count == 0)
            {
                Document.RePublishAll();
                library.RefreshContent();
            }
            Response.Redirect("/");

    In order to make sure the redirect occurs even if not republished.

     

  • Tom Maton 387 posts 660 karma points
    Feb 24, 2011 @ 09:35
    Tom Maton
    0

    Hi Paul,

    Yep, i'm with softsys and all my sites experienced the same problem.

    I cant remember getting an email though from Softsys stating this :(

    Tom

  • Paul Blair 466 posts 731 karma points
    Feb 24, 2011 @ 09:55
    Paul Blair
    0

    no email would have been sent. I found out by going to http://members.softsyshosting.com/announcements.php

    I've asked them to add these announcements to twitter but that has not been done yet - they mainly use their twitter account for tweeting customer reviews (which seems a bit pointless)

  • Happyfanaticsalsero 59 posts 81 karma points
    Feb 24, 2011 @ 10:40
    Happyfanaticsalsero
    1

    You can subscribe to the RSS feed of the announcements - that how I keep track of them.

  • Kyle Skrinak 272 posts 327 karma points
    Apr 05, 2011 @ 00:51
    Kyle Skrinak
    0

    Is there a way to force this error to confirm whether the noNodes.aspx fix from Darren (and amended by Claire) works as intended, at least in my environment?

    Thanks!

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Apr 05, 2011 @ 00:56
    Tom Fulton
    0

    You should be able to reproduce by stopping the website & DB server (or somehow preventing access to it), then starting the website and visiting it while the DB is still inaccessible.  Then you should get the no nodes page, even after starting the DB server again.

  • Ted Jardine 98 posts 120 karma points
    Apr 08, 2011 @ 02:31
    Ted Jardine
    0

    I've made this a Codeplex issue at http://umbraco.codeplex.com/workitem/30236.

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Apr 08, 2011 @ 03:30
    Tom Fulton
    0

    I think this was already fixed for 4.7, per http://umbraco.codeplex.com/workitem/29833

  • Ted Jardine 98 posts 120 karma points
    Apr 08, 2011 @ 20:29
    Ted Jardine
    0

    Tom is correct as it appears this issue has been addressed in 4.7.

     

    Thanks Tom!

  • FreedomChicken 12 posts 33 karma points
    Apr 20, 2011 @ 22:26
    FreedomChicken
    0

    I seem to be getting this issue, or one very similar at least

    umbraco v 4.7.0 (Assembly version: 1.0.4090.38017)

    To Reproduce
    Loaded a RePublishig page to tax the Sql DB
    Recycled the Umbrco App Pool
    Then imeedietly did the "Republish entire site"

    Then no nodes will display data, instead it will just be a 404

    At / (Referred by: ): System.NullReferenceException: Object reference not set to an instance of an object. at umbraco.requestHandler..ctor(XmlDocument umbracoContent, String url) at umbraco.UmbracoDefault.Page_PreInit(Object sender, EventArgs e) at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) at System.EventHandler.Invoke(Object sender, EventArgs e) at System.Web.UI.Page.OnPreInit(EventArgs e) at System.Web.UI.Page.PerformPreInit() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

  • Dan Evans 629 posts 1016 karma points
    May 03, 2012 @ 12:16
    Dan Evans
    0

    We are running 4.6.1 and are getting this problem. The DB connection fails then we end up with a 1KB umbraco.config file.

    We don't get the no nodes page but the same as the above post.

    Problem is made worse as the site is very big and it takes 15 minutes or so to rebuiild the XML which is proving very embarrassing.

    Any ideas? Solutions?

  • Jeroen Breuer 4908 posts 12265 karma points MVP 4x admin c-trib
    May 03, 2012 @ 17:36
    Jeroen Breuer
    0

    Is it an option to upgrade to Umbraco 4.7? The 4.6 version did have a lot of problems which are fixed in 4.7.

    Jeroen

  • Ted Jardine 98 posts 120 karma points
    May 03, 2012 @ 19:32
    Ted Jardine
    0

    Optimally you would do an upgrade to 4.7.2. If that's not a possibility for some reason, you *could* take the 4.6 build, track down the fix (referenced somewhere else in this thread) and implement.

    Ted

  • Paul T 1 post 21 karma points
    May 21, 2012 @ 20:59
    Paul T
    0

    Although I'm not an Umbraco developer, (I normally work with another CMS) I came across this thread because I had a client's site we inherited that was having this issue. The repair code above gave me an error and did not complete. It seemed to fail because the umbraco.config file was still open after checking for valid nodes.

    This is my variation on the revised NoNodes.aspx page. This will rebuild the cache file if missing or has no nodes. It also will give a little feedback to let you know what's going on.

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="noNodes.aspx.cs" Inherits="umbraco.presentation.config.splashes.noNodes" %>
    
    <%@ Import Namespace="umbraco" %>
    <%@ Import Namespace="System.Xml" %>
    <%@ Import Namespace="umbraco.cms.businesslogic.web" %>
    <%@ Import Namespace="umbraco.IO" %>
    <script runat="server">    
        protected void Page_Load(object sender, EventArgs e)
        {
            Server.ScriptTimeout = 100000;
            var cacheFile = IOHelper.MapPath("/App_Data/umbraco.config");
            try
            {
                var r = XmlReader.Create(cacheFile, new XmlReaderSettings() { DtdProcessing = DtdProcessing.Ignore });
                var d = new XmlDocument();
                d.Load(r);
                var n = d.SelectSingleNode("//root");
                r.Close();
                if (n.ChildNodes.Count == 0)
                {
                    Response.Write("Republishing Site......");
                    Response.Flush();
                }
                else
                {
                    Response.Write("Site Was Already Published......");
                    return;
                }
            }
            catch (Exception ex)
            {
                Response.Write(ex.Message);
                Response.Write("Cache missing, republishing.....");
                Response.Flush();
            }
    
            Document.RePublishAll();
            library.RefreshContent();
    
            Response.Write("Completed");
            Response.Flush();
    
            Response.End();
        }
    </script>
    
Please Sign in or register to post replies

Write your reply to:

Draft