报告查看器错误消息“客户端发现响应内容类型为 '',但预期为 'text xml' 请求失败,响应为空." [英] Report viewer Error message "client found response content type of '' but expected 'text xml' The request failed with an empty response."

查看:46
本文介绍了报告查看器错误消息“客户端发现响应内容类型为 '',但预期为 'text xml' 请求失败,响应为空."的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我收到错误

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);

错误发生在线路上:

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");

我需要使用报告查看器加载报告,以便可以导出为 PDF.

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

推荐答案

尝试将 Uri 设置为全服务 uri,例如:

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

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

此外,您是否需要尾随 ??我不确定,但如果 SetParameters 需要,它不会被附加吗?

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

这篇关于报告查看器错误消息“客户端发现响应内容类型为 '',但预期为 'text xml' 请求失败,响应为空."的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆