none
Microsoft Report Viewer RRS feed

  • Question

  • I am building a ASP.NET C# application using ASP.NET version 4.6.1, and a 2016 SQL Server Report Server.


    I am using the Microsoft.ReportViewer.WebForms, Version=15.0.0.0, and when I go to display the report, I get this error message:

    Client found response content type of 'text/html; charset=UTF-8', but expected 'text/xml'.

    Here is my code:


    string report = "Client"; 

                    

                    ReportViewer1.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Remote;

                    IReportServerCredentials irsc = new CustomReportCredentials(System.Configuration.ConfigurationManager.AppSettings["ReportUserName"], System.Configuration.ConfigurationManager.AppSettings["ReportPassword"], System.Configuration.ConfigurationManager.AppSettings["ReportDomain"]);

                    ReportViewer1.ServerReport.ReportServerCredentials = irsc;



                    ReportViewer1.ServerReport.ReportServerUrl = new Uri(System.Configuration.ConfigurationManager.AppSettings["ReportURL"]);



                    ReportViewer1.ServerReport.ReportPath = System.Configuration.ConfigurationManager.AppSettings["ReportFolder"] + report;                



                    List<ReportParameter> paramList = new List<ReportParameter>();



                    paramList.Add(new ReportParameter("ClientID", this.txtClientID.Text, false)); 

                    

                    this.ReportViewer1.ServerReport.SetParameters(paramList);



                    // Process and render the report

                    ReportViewer1.KeepSessionAlive = true;

                    ReportViewer1.ServerReport.Refresh();


    Here is my web.config:


        <add key="ReportUserName" value="xxx"/>

        <add key="ReportPassword" value="xxx"/>

        <add key="ReportDomain" value="xxx"/>

        <add key="ReportURL" value="http://xxx/Reports"/>

        <add key="ReportFolder" value="/report/xxx/"/>







    Tuesday, June 23, 2020 9:55 PM

Answers

  • I got it working.

    I updated my web.config, removing the '/report' from the ReportFolder

    <add key="ReportUserName" value="xxx"/>

        <add key="ReportPassword" value="xxx"/>

        <add key="ReportDomain" value="xxx"/>

        <add key="ReportURL" value="http://xxx/Reports"/>

        <add key="ReportFolder" value="/report/xxx/"/>

    to

    <add key="ReportUserName" value="xxx"/>

        <add key="ReportPassword" value="xxx"/>

        <add key="ReportDomain" value="xxx"/>

        <add key="ReportURL" value="http://xxx/Reports"/>

        <add key="ReportFolder" value="/xxx/"/>


    Wednesday, July 1, 2020 5:51 PM

All replies

  • Hi Thomas A Wolfe,

    In Reporting Service, this error is caused by calling web services failure. For rendering a report, we should add execution endpoint to URL. ReportExecution2005 endpoint takes effect when developers customize report processing and rendering from a report server. Try setting the Uri to the full service uri, eg: new Uri("http://server/ReportServer$.../reportservice2005.asmx?")

    Besides that, you also can choose either of the following approaches for trouble shooting:

    • On the computer that hosts the report server, continue to run the Report Server service as NetworkService and add the built-in account, such as NT_AUTHORITY\NetworkService to the WSS_WPG Windows group.

    -- Or --

    • Configure the service account to run under a domain user account as follows:
             Start the Reporting Services Configuration tool and connect to the report server.
             On the Service Account page, click Use another account, enter a domain user account, and click Apply.
             Click Web Service Identity, for Report Server, click New, type an application Restart the Report Server service.

    Here are some same threads may help:

    client found response content type of ", but expected 'text/xml'.

    Report viewer Error message “client found response content type of '' but expected 'text xml' The request failed with an empty response.”

    Hope it will help

    Best Regards

    Dawn



    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, June 24, 2020 3:00 AM
  • I added a web reference to http://rcit-xxx/ReportServer/ReportExecution2005.asmx?wsdl and it works with this code:

    ReportExecutionService reportExecutionService = new ReportExecutionService();   // Web Service proxy
                    reportExecutionService.Credentials = new NetworkCredential("SVC_xxx", "xxx", "rivcoca");

                    string reportPath = "/AssureCare/Client";
                    string format = "PDF";

                    // Render arguments
                    byte[] result = null;
                    string historyID = null;

                    string encoding;
                    string mimeType;
                    string extension;
                    Warning[] warnings = null;
                    string[] streamIDs = null;

                    ParameterValue[] parameters = new ParameterValue[4];
                    parameters[0] = new ParameterValue();
                    parameters[0].Name = "ClientID";


                    ExecutionInfo execInfo = new ExecutionInfo();
                    ExecutionHeader execHeader = new ExecutionHeader();

                    reportExecutionService.ExecutionHeaderValue = execHeader;

                    execInfo = reportExecutionService.LoadReport(reportPath, historyID);

                    String SessionId = reportExecutionService.ExecutionHeaderValue.ExecutionID;
                    parameters[0].Value = this.txtClientID.Text;

                    reportExecutionService.SetExecutionParameters(parameters, "nl-nl");
                    result = reportExecutionService.Render(format, null, out extension, out encoding, out mimeType, out warnings, out streamIDs);

                    Response.ClearContent();
                    Response.AppendHeader("content-length", result.Length.ToString());
                    Response.ContentType = "application/pdf";
                    Response.BinaryWrite(result);
                    Response.End();
                    //Response.Flush();
                    //Response.Close();

    What I want though is to use the Report Viewer Control

    https://docs.microsoft.com/en-us/sql/reporting-services/application-integration/integrating-reporting-services-using-reportviewer-controls-get-started?view=sql-server-ver15#:~:text=%20Adding%20the%20Report%20Viewer%20control%20to%20a,to%20the%20toolbox.%0AC%204%20%0Aprivate%20Microsoft.Reporting.WinForms.ReportViewer...%20More%20

    But I don't know what ReportServerUrl and ReportPath to use.

    I tried using mulitiple URL's including http://rcit-xxx/ReportServer/ReportExecution2005.asmx/Reports/report/AssureCare/Client/AssureCare?/AssureCare/Client 

    but I get file not found or

    Client found response content type of '', but expected 'text/xml'.

    Saturday, June 27, 2020 9:23 PM
  • Hi friend,

    Have you tried the methods I posted? And the thread also will help.


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, June 29, 2020 6:53 AM
  • I got it working.

    I updated my web.config, removing the '/report' from the ReportFolder

    <add key="ReportUserName" value="xxx"/>

        <add key="ReportPassword" value="xxx"/>

        <add key="ReportDomain" value="xxx"/>

        <add key="ReportURL" value="http://xxx/Reports"/>

        <add key="ReportFolder" value="/report/xxx/"/>

    to

    <add key="ReportUserName" value="xxx"/>

        <add key="ReportPassword" value="xxx"/>

        <add key="ReportDomain" value="xxx"/>

        <add key="ReportURL" value="http://xxx/Reports"/>

        <add key="ReportFolder" value="/xxx/"/>


    Wednesday, July 1, 2020 5:51 PM