Root element is missing error

Mar 2, 2011 at 2:44 AM

I'm getting this error when trying to navigate to my blog: Root element is missing error.

This happened without any known changes on my part.

You can see it here:


How does something like this happen?  How can I fix it?  Thanks!


Server Error in '/blog' Application.

Root element is missing.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Xml.XmlException: Root element is missing.

Source Error:

Line 85:     void Application_Start(object sender, EventArgs e)
Line 86: {
Line 87: Utils.LoadExtensions();
Line 88: }
Line 89:

Source File: d:\inetpub\vhosts\\httpdocs\blogenginenet\Global.asax    Line: 87

Stack Trace:

[XmlException: Root element is missing.]
System.Xml.XmlTextReaderImpl.Throw(Exception e) +76
System.Xml.XmlTextReaderImpl.ThrowWithoutLineInfo(String res) +61
System.Xml.XmlTextReaderImpl.ParseDocumentContent() +3979720
System.Xml.XmlTextReaderImpl.Read() +151
System.Xml.XmlTextReader.Read() +15
System.Xml.XmlReader.MoveToContent() +64
Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderManagedExtension.Read6_ManagedExtension() +19

[InvalidOperationException: There is an error in XML document (0, 0).]
System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events) +613
System.Xml.Serialization.XmlSerializer.Deserialize(Stream stream) +102
ExtensionManager.DataStoreExtension(String name) in D:\Projects\Be-1610\BlogEngine\DotNetSlave.BusinessLogic\Web\Extensions\ExtensionManager.cs:254
ExtensionManager.LoadExtensions() in D:\Projects\Be-1610\BlogEngine\DotNetSlave.BusinessLogic\Web\Extensions\ExtensionManager.cs:210
ExtensionManager.ExtensionEnabled(String extensionName) in D:\Projects\Be-1610\BlogEngine\DotNetSlave.BusinessLogic\Web\Extensions\ExtensionManager.cs:55
BlogEngine.Core.Utils.LoadExtensions() in D:\Projects\Be-1610\BlogEngine\DotNetSlave.BusinessLogic\Utils.cs:543
ASP.global_asax.Application_Start(Object sender, EventArgs e) in d:\inetpub\vhosts\\httpdocs\blogenginenet\Global.asax:87

[HttpException (0x80004005): There is an error in XML document (0, 0).]
System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app) +2722614
System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +128
System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +188
System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +295
System.Web.HttpApplicationFactory.GetPipelineApplicationInstance(IntPtr appContext, HttpContext context) +56
System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +231

[HttpException (0x80004005): There is an error in XML document (0, 0).]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +8897503
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +85
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +333

Version Information: Microsoft .NET Framework Version:2.0.50727.4206; ASP.NET Version:2.0.50727.4209

Mar 2, 2011 at 8:56 AM

I would try deleting all the files in the App_Data\datastore\extensions folder.  And probably make a backup first (before deleting).

If that doesn't solve it, this person said he re-uploaded the blog files to his site, and that eliminated the error.

Is this a new installation?  Or has it been running for a while?

Mar 2, 2011 at 6:56 PM

Thanks Ben.


Deleting the files in App_Data\datastore\extensions didn't work, so I downloaded a backup from awhile ago, deleted the entire \blogenginenet\ directory, and then copied the backup directory back to the server via FTP.  This worked after I logged into the control panel for my domain and changed the permissions for the \blogenginenet\App_Data\datastore/extensions directory to enable read access, and the \blogenginenet\App_Data\posts\ directory to enable write access.


Any idea on how this misconfiguration could have happened in the first place?  I'd like to avoid downtime in the future :)


This wasn't a new installation - it has been running for 4+ months.

Mar 3, 2011 at 8:41 AM

You could check in the App_Data folder to see if there is a Logger.txt file.  It's possible it recorded details on the error.  Although for BE 1.6.1, details might not have been recorded ... we've added some extra logging in BE 2.0, but there might still be some logging in BE 1.6 too.

I'm not sure the reason for the error, but I think the error occurs when one of the XML files containing extension metadata is being read.  If logging doesn't exist, then a good step for us to take would be to add logging, so the exact XML file is logged in logger.txt.  Then when this happens, you could look at that XML file to see if it's corrupt, or malformed in some way ... and possibly replace that single file or fix it.  Actually, in addition to this, it might be good if we not only logged which XML file was causing the error, but caught this error so it doesn't go an unhandled and completely cause the whole process to fail.  It could log which file has the problem, and continue on processing the other files -- skipping the problematic one.  At least with something like this, the blog can continue to run.  I'll look into doing this.

This information may not help you directly, but if we can get these changes in, and you upgrade to a newer version of BE someday, then at least the changes would help you then.  In the meantime, hopefully this error doesn't come back for you, or at least if it does, you have an idea on how to fix it.

Mar 7, 2011 at 11:47 PM

Thanks Ben for your help.


I checked the Logger.txt file but I guess the logging for this particular error wasn't in version 1.6 as the only statements I see are related to stopping spam.

Oct 15, 2011 at 3:55 PM

Same thing suddenly happened to a site belonging to a client of mine.  Logs only showed all the blog comments id'd as spam.  In ftp connection could see that all the extensions xml files had a new file date of 2 days ago, whereas we'd made no changes, hadn't touched files or file admin for a couple of months.  I checked permissions as above, all were read-write-execute across the board, so I made extensions read only for puhlic and group, and removed execute from posts folder, as chkbhodge, above, tried, and then I re-upped all the xml extension files.  No change, no site.  I deleted the load_extensions routine from global.asax and changed web.config formatting to force new compilation, and now the site loads fine - don't know what'll happen when the blog is used!  Will look into updating BlogEngine version to see if new files that way help, but hate to get into it ... Just don't know what else to try. 

Nov 17, 2011 at 6:19 AM

Ooops! An unexpected error has occurred.

This one's down to me! Please accept my apologies for this - I'll see to it that the developer responsible for this happening is given 20 lashes (but only after he or she has fixed this problem).
blogengine System.Xml.XmlException: Root element is missing.

Earlier happened like this, i had to reupload whole engine to set it right.

But today, I just took a backup of App_Data/Posts/all files. Then I have found a new xml file was created earlier with no data xml format in it. I just deleted and also deleted the recent comments of last updated files last few days.

The site is up now...


Hope this solves.

Mar 15, 2013 at 3:12 AM
I had to delete a file named AkismetFilter.xml from the App_Data/datastore/extensions folder. Once I did that my site came right up.