We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

SSRS 2017: System.Xml.XmlException: For security reasons DTD is prohibited in this XML document

I'm getting the following error when I try and load a report;

_reportLoaded:Sf_Exception - System.Xml.XmlException: For security reasons DTD is prohibited in this XML document. To enable DTD processing set the DtdProcessing property on XmlReaderSettings to Parse and pass the settings into XmlReader.Create method. at Syncfusion.RDL.Data.ReportModel.ProcessReport() at Syncfusion.EJ.ReportViewer.Internal.ReportViewerLayoutModel.LoadReport() at Syncfusion.EJ.ReportViewer.Internal.ReportViewerInternalHelper.ReportLoad() at Syncfusion.EJ.ReportViewer.Internal.ReportViewerInternalHelper.ProcessReport()

My view code;

@model string
@addTagHelper "*, Syncfusion.EJ"
@{ 
    Layout = null;
}
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Carrier Credit Services Report</title>
    <link rel="stylesheet" rel='nofollow' href="https://cdn.syncfusion.com/16.4.0.42/js/web/flat-azure/ej.web.all.min.css" />
    <script src="/assets/vendors/general/syncfusion/custom/jquery-1.10.2.min.js"></script>
    <script src="/assets/vendors/general/syncfusion/custom/jquery.easing.1.3.min.js"></script>
    <script src="https://cdn.syncfusion.com/16.4.0.42/js/web/ej.web.all.min.js"></script>
    <style>
        body, html, #reportviewer {
            padding: 0px;
            margin: 0px;
            overflow: hidden !important;
            height: 100%;
            width: 100%;
        }
    </style>
    <link rel="apple-touch-icon" sizes="180x180" rel='nofollow' href="/assets/media/favicon/apple-touch-icon.png">
    <link rel="icon" type="image/png" sizes="32x32" rel='nofollow' href="/assets/media/favicon/favicon-32x32.png">
    <link rel="icon" type="image/png" sizes="16x16" rel='nofollow' href="/assets/media/favicon/favicon-16x16.png">
    <link rel="mask-icon" rel='nofollow' href="/assets/media/favicon/safari-pinned-tab.svg" color="#5bbad5">
    <meta name="msapplication-TileColor" content="#da532c">
    <meta name="theme-color" content="#ffffff">
</head>
<body style="height:100%;width:100%;padding:0;">
    <ej-report-viewer id="reportviewer1" 
report-service-url="/Ssrs" 
report-path="/InvCountHistory" 
processing-mode="Remote" 
ReportServerUrl="http://e7480nshepherd2:80/ReportServer_SSRS"></ej-report-viewer>
    <ej-script-manager></ej-script-manager>
</body>
</html>

My Controller code;

        public void OnInitReportOptions(ReportViewerOptions reportOption)
        {
            reportOption.ReportModel.ReportPath = "/InvCountHistory";
            reportOption.ReportModel.ReportServerUrl = "http://e7480nshepherd2:80/ReportServer_SSRS";
        }



9 Replies

MM Mageshyadav M Syncfusion Team February 6, 2019 05:24 AM UTC

Hi Nick, 
 
Thanks for your interest in our Syncfusion product. 
 
The mentioned problem occurs when we did not pass the SSRS server credentials for rendering the report in Report Viewer. So could you please specify the SSRS server credentials and also if report have Datasource with credentials then specify the credentials as shown in below code snippet. 
 
        public void OnInitReportOptions(Syncfusion.EJ.ReportViewer.ReportViewerOptions reportOption) 
        { 
            //Adds SSRS Server and Database Credentials here. 
            //reportOption.ReportModel.ReportServerCredential = new System.Net.NetworkCredential("<username>", "<password>"); 
            reportOption.ReportModel.ReportServerCredential = new System.Net.NetworkCredential("test", "Test@123"); 
            //reportOption.ReportModel.DataSourceCredentials.Add(new DataSourceCredentials("<Datasource name>", "username", "password")); 
            reportOption.ReportModel.DataSourceCredentials.Add(new DataSourceCredentials("FADatasource", "sa", "Test@123")); 
        } 
 
We have prepared the ASP.NET Core sample for rendering the SSRS server report in our Report Viewer and it can be downloaded from below location. 
 
Please find the below help document for how to configure the SSRS server in Report Viewer. 
 
Regards, 
Mageshyadav.M 



NS Nick Shepherd February 6, 2019 06:06 AM UTC

Hi,

Thanks for the reply, with the sample solution I get the same exception.

Any ideas?

Also the SSRS service URL in the sample you linked didn't work.

Cheers,

Nick


MM Mageshyadav M Syncfusion Team February 6, 2019 06:41 AM UTC

Hi Nick, 
 
Please find the below response for your queries. 
 
Query 
Response 
Thanks for the reply, with the sample solution I get the same exception. 
Yes, this issue will occur when Server credentials invalid for specified server URL. 
Also the SSRS service URL in the sample you linked didn't work. 
 
In our previously shared sample will contain only our local URL and sample credentials and it will not work on your side because we did not host our testing SSRS server public due to licensing. So you need to change your server URL, report path and your credentials to avoid the mentioned problem at your end. 
 
Please find the below code snippet for how to pass a server URL, report path in client side. 
@{ 
    ViewData["Title"] = "ReportViewer ASP.NET CORE Support"; 
} 
<style> 
    body, html, #reportviewer { 
        overflow: hidden !important; 
        height: 100%; 
        width: 100%; 
    } 
</style> 
@*<ej-report-viewer id="reportviewer1" report-service-url="../Home" report-server-url="<pass your SSRS server URL>" report-path="<pass your report path>" />*@ 
<ej-report-viewer id="reportviewer1" report-service-url="../Home" report-server-url="http://localhost/ReportServer" report-path="/CustomerTesting" processing-mode="Remote" /> 
<ej-script-manager></ej-script-manager> 
 
Please find the below code snippet for how to pass the server credentials, and if report uses datasource with credentials then need to pass those credentials for datasource in server side as shown below. 
 
        public void OnInitReportOptions(Syncfusion.EJ.ReportViewer.ReportViewerOptions reportOption) 
        { 
            //Adds SSRS Server and Database Credentials here. 
            //reportOption.ReportModel.ReportServerCredential = new System.Net.NetworkCredential("<pass Server username>", "<pass password>"); 
            reportOption.ReportModel.ReportServerCredential = new System.Net.NetworkCredential("testing", "testing@123"); 
            //reportOption.ReportModel.DataSourceCredentials.Add(new DataSourceCredentials("<pass Datasource name>", "<pass User name>", "<pass password>")); 
            reportOption.ReportModel.DataSourceCredentials.Add(new DataSourceCredentials("FADatasource", "sa", "test@123")); 
        } 
 
 
Regards, 
Mageshyadav.M 



NS Nick Shepherd February 6, 2019 10:15 PM UTC

I've got to the bottom of the issue. It appear that you have a bug in your code. 

I decompiled "Syncfusion.Report.Core.Intenal.Server" and I saw that you have the Rest API calls hard-coded such as;

    public const string GetCatalogItemApi = "/reports/api/v2.0/CatalogItems({0})/Content/$value";
    public const string GetReportDataSourcesApi = "/reports/api/v2.0/Reports({0})/DataSources";
    public const string GetReportSharedDataSetsApi = "/reports/api/v2.0/Reports({0})/SharedDataSets";
    public const string GetDataSetDataSourcesApi = "/reports/api/v2.0/DataSets({0})/DataSources";

In the InvokeServerApiRequest method you set the BaseAddress of the HttpClient object and then make calls against the HttpClient. This approach requires that the URL for the report server is always "http://<URL>/reports/" I believe the default for SQL 2017 is 'http://<URL>/ReportServer_SSRS/'

To resolve this issue you must updated the string constants for the Rest URLs and make a trailing slash mandatory for the ReportServerUrl.

See: https://stackoverflow.com/questions/23438416/why-is-httpclient-baseaddress-not-working

Cheers,

Nick

 


MM Mageshyadav M Syncfusion Team February 7, 2019 12:52 PM UTC

Hi Nick, 

Thanks for your update. We have validated the mentioned problem. We have logged the improvement task on this and it will be estimated to be available in next weekly nuget release which will roll out on February 12, 2019. 

Regards, 
Mageshyadav.M 



NS Nick Shepherd February 13, 2019 06:16 PM UTC

Do you know if this was resolved in the latest release?

Cheers,

Nick


MM Mageshyadav M Syncfusion Team February 14, 2019 11:01 AM UTC

Hi Nick, 
  
Sorry for the delay. 
  
We are unable to complete the changes and include in weekly nuget release version 16.4.0.53. We will update the changes in next weekly nuget which will roll out on February 19, 2019. 
  
Regards, 
Mageshyadav.M 
  



NS Nick Shepherd February 19, 2019 03:30 PM UTC

Hi,

Was this issues resolved in .54?

Cheers,

Nick


MM Mageshyadav M Syncfusion Team February 20, 2019 11:46 AM UTC

Hi Nick, 

We have resolved the reported problem and unable to include the fix changes to the latest weekly nuget release(16.4.0.54) so we will update the changes in next weekly nuget which will roll out on 26th February, 2019. Since we have prepared custom nuget packages with the fix changes for your use. It will be available from the below download link. 

 
Note : Before nuget installation please delete the existing older nuget from your machine using below steps. 
Step 1 : Press Win + Run and type "%userprofile%\.nuget\packages" to open the system nuget folder. 
Step 2: Under the nuget please delete the existing folder name syncfusion.ej.reportviewer.aspnet.core and then proceed the nuget installation. 

Regards, 
Mageshyadav.M 


Loader.
Live Chat Icon For mobile
Up arrow icon