This project is read-only.

Root element is missing

Topics: ASP.NET 2.0, Controls
Mar 7, 2011 at 10:17 PM

Hi Guys, 

I cannot currently access my blog site due to the error shown below.

Right now, I don't have much idea how to fix this problem.  Need your help.  Thanks...

(Btw, I'm now using version 1.5 of BE.NET.)

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 42:       {
Line 43: int number = BlogSettings.Instance.NumberOfRecentPosts;
Line 44: if (number > Post.Posts.Count)
Line 45: number = Post.Posts.Count;
Line 46:

Source File: c:\HostingSpaces\guiadosq\\wwwroot\blog\App_Code\Controls\RecentPosts.cs    Line: 44

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.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace) +112
System.Xml.XmlDocument.Load(XmlReader reader) +108
System.Xml.XmlDocument.Load(String filename) +87
BlogEngine.Core.Providers.XmlBlogProvider.SelectPost(Guid id) +241
BlogEngine.Core.Providers.BlogService.SelectPost(Guid id) +44
BlogEngine.Core.Post.DataSelect(Guid id) +32
BlogEngine.Core.Post.Load(Guid id) +61
BlogEngine.Core.Providers.XmlBlogProvider.FillPosts() +222
BlogEngine.Core.Post.get_Posts() +74
Controls.RecentPosts.BuildPostList() in c:\HostingSpaces\guiadosq\\wwwroot\blog\App_Code\Controls\RecentPosts.cs:44
Controls.RecentPosts..cctor() in c:\HostingSpaces\guiadosq\\wwwroot\blog\App_Code\Controls\RecentPosts.cs:22

[TypeInitializationException: The type initializer for 'Controls.RecentPosts' threw an exception.]
Controls.RecentPosts..ctor() +0
ASP.themes_gdq_site_master.__BuildControlrp() in c:\HostingSpaces\guiadosq\\wwwroot\blog\themes\GdQ\site.master:101
ASP.themes_gdq_site_master.__BuildControlForm1() in c:\HostingSpaces\guiadosq\\wwwroot\blog\themes\GdQ\site.master:16
ASP.themes_gdq_site_master.__BuildControlTree(themes_gdq_site_master __ctrl) in c:\HostingSpaces\guiadosq\\wwwroot\blog\themes\GdQ\site.master:1
ASP.themes_gdq_site_master.FrameworkInitialize() in c:\HostingSpaces\guiadosq\\wwwroot\blog\themes\GdQ\site.master.cs:912308
System.Web.UI.UserControl.InitializeAsUserControlInternal() +35
System.Web.UI.MasterPage.CreateMaster(TemplateControl owner, HttpContext context, VirtualPath masterPageFile, IDictionary contentTemplateCollection) +8670655
System.Web.UI.Page.get_Master() +51
System.Web.UI.Page.ApplyMasterPage() +15
System.Web.UI.Page.PerformPreInit() +45
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +282

Mar 8, 2011 at 4:56 PM

First thing I would do is restart the blog engine by making a change to the web.config file (just add a space or something), and then upload again. See if that works. If not, go into your App_Data/Posts directory and see if you have any posts with no data in it. If so, that would be the issue. You can remove or backup those files then restart the blog engine again.

Jun 30, 2014 at 7:47 PM
I had a similar problem , which was due to upload of a blank post.
to fix this problem Navigate to
in this folder try and search for XML with Zero KB size , once found either remove or rename the extension and your site should be up.