New to Telerik Reporting? Download free 30-day trial

This document already has a 'DocumentElement' node exception.

Environment

Product Progress® Telerik® Reporting
Report Viewer ASP.NET WebForms Report Viewer

This article relates to the Legacy ASPNET Report Viewer.

Description

Visual Studio throws the exception when adding a ReportViewer control to an .aspx page.

Error Message

The ReportViewer control failed to setup the http handler in the web.config file. 
You may experience troubles when viewing the report.   

Exception details:  This document already has a 'DocumentElement' node.

Cause

This happens when a default namespace is added to the root <configuration> element of the web.config file.

For example:

<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">

Solution

This doesn’t cause any runtime problems, but in case you try to alter the web.config like we do, it would throw the exception.

To avoid the error, delete the xmlns reference and have the root configuration element look like the following:

<configuration> 

Also, restart Visual Studio. Once you start it back up, we would successfully alter the web.config adding our http handlers for the ReportViewer with no errors.

Notes

Another "side-effect" of having default namespace is missing intellisense for the web.config file.

See Also

VS 2005 Intellisense in web.config files

In this article