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

人走茶凉 提交于 2020-01-02 02:29:10

问题


I'm getting the error

client found response content type of '' but expected 'text xml' The request failed with an empty response.

when I try to execute the following code.

//create a PDF from the SQL report
ReportViewer rview = new ReportViewer();

rview.ServerReport.ReportServerUrl = new Uri("http://server/ReportServer$MSSQL2K5?");

List<ReportParameter> paramList = new List<ReportParameter>();
paramList.Add(new Microsoft.Reporting.WinForms.ReportParameter("Batch", "1"));
paramList.Add(new Microsoft.Reporting.WinForms.ReportParameter("InvoiceNo", "0"));
rview.ServerReport.ReportPath = "Report/Report Invoice";

rview.ServerReport.SetParameters(paramList);

string mimeType, encoding, extension, deviceInfo;
string[] streamids;
Microsoft.Reporting.WinForms.Warning[] warnings;
string format = "PDF"; //Desired format goes here (PDF, Excel, or Image)             

deviceInfo =
"<DeviceInfo>" +
"<SimplePageHeaders>True</SimplePageHeaders>" +
"</DeviceInfo>";

byte[] bytes = rview.LocalReport.Render(format, deviceInfo, out mimeType, out encoding, out extension, out streamids, out warnings);

The error occurs on the line:

rview.ServerReport.SetParameters(paramList);

The address is correct as I can load the report fine via a web browser:

this.webBrowser1.Navigate("http://server/ReportServer$MSSQL2K5?/Report/Report Invoice&Batch=1&InvoiceNo=0");

I need to load the report with the report viewer so I can export as PDF.


回答1:


Try setting the Uri to the full service uri, eg:

new Uri("http://server/ReportServer$MSSQL2K5/reportservice2005.asmx?")

Additionally, do you need the trailing ?? I'm not sure, but wouldn't it be appended if needed by SetParameters?




回答2:


In my case this error was caused by the SSRS server running out of hard drive space.




回答3:


On my side, the service (SSRS) was hanging on the server side, had to force stop service and restart it.



来源:https://stackoverflow.com/questions/3865825/report-viewer-error-message-client-found-response-content-type-of-but-expect

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!