Reputation: 2014
I'm getting an issue, see the below, when rendering a pdf report from our SSRS. I have tried to look into different sources and nothing works so far.
Microsoft.Reporting.WebForms.Internal.Soap.ReportingServices2005.Execution.RSExecutionConnection.MissingEndpointException: 'The attempt to connect to the report server failed. Check your connection information and that the report server is a compatible version.'
I have these line of codes which should work:
var parameters = new List<ReportParameter>
{
new ReportParameter("paramter_1", "paramter_1_value"),
};
var reportServerUrl = ConfigurationManager.AppSettings["ReportServerUrl"];
reportViewer.ServerReport.ReportServerUrl = new Uri(reportServerUrl);
reportViewer.ServerReport.ReportPath = '/ReportFolder/ReportName';
reportViewer.ServerReport.ReportServerCredentials = new CustomCredentials();
reportViewer.ServerReport.SetParameters(parameters);
reportViewer.ServerReport.Refresh();
var mimeType = "";
var encoding = "";
var filenameExtension = "pdf";
string[] streamids = null;
Warning[] warnings = null;
var outputFileName = "File_Name.pdf";
var bytes = reportViewer.ServerReport.Render("PDF", null, out mimeType, out encoding, out filenameExtension, out streamids, out warnings);
var pdfReport = File(bytes, "application/pdf", outputFileName);
Am I doing anything wrong here?
Upvotes: 0
Views: 1227
Reputation: 2014
For anyone who might experience this, It's a silly mistake. I've been using the http://server/reports
which is used to open a report on the web.
You might want to check the Report Server Configuration Manager and make sure you use the URL that is pointing to the configured virtual path. So say, the virtual path is reportserver
, you have to use this as your ReportServerUrl in order for you to render a report.
reportViewer.ServerReport.ReportServerUrl = new Uri("http://server/reportserver");
Upvotes: 1
Reputation: 66
A few things you can try:
Upvotes: 1