I have a windows 2008 server running SSRS on SQL 2008. It is also a web server with Plesk installed.
I have been developing reports for this server for some time now on a development server. Everything is working fine on the development server. But I tried to move the reports to the live server and I get the error below:
Server Error
404 - File or directory not found. The resource you are looking for might have been removed, had its name changed, or is temporarily unavailable.
I am not sure why this is happening, because when I access the reports URL on its own it works fine. But as soon as I call the report in my web application hosted on the very same server I get this error. My application is written in c# and asp.net. Here is a section of code I use to access the report. Any help would be greatly appreciated:
string ExpId1 = Convert.ToString(Request.QueryString["Id"]).Trim();
string ExpId2 = ExpId1.Replace("@", "+");
Int32 ExpId3 = Convert.ToInt32(qsc.decryptQueryString(ExpId2));
string id=ExpId3.ToString();
ReportViewer1.Width = 1050;
ReportViewer1.Height = 600;
ReportViewer1.Style.Add("Overflow", "Scroll");
ReportViewer1.ProcessingMode = ProcessingMode.Remote;
IReportServerCredentials irsc = new CustomReportCredential开发者_如何学Cs("user", "password", "server");
ReportViewer1.ServerReport.ReportServerCredentials = irsc;
ReportParameter[] para = new ReportParameter[2];
para[0] = new ReportParameter();
para[0].Name = "ExpHearderId";
para[0].Values.Add(id);//any value
para[1] = new ReportParameter();
para[1].Name = "ExpHeadreId";
para[1].Values.Add(id);//any value
ReportViewer1.ServerReport.ReportServerUrl = new Uri("http://xxx.xxx.xxx.xxx/reportserver_TGO");
string path=Server.MapPath("~/ReportingofUsers/ExpenseClaimReport");
ReportViewer1.ServerReport.ReportPath = path;
ReportViewer1.ServerReport.SetParameters(para);
ReportViewer1.ShowParameterPrompts = false;
ReportViewer1.ServerReport.Refresh();
ReportViewer1.Visible = true;
This should help: http://otkfounder.blogspot.com/2007/11/solving-reportviewer-rendering-issue-on.html
EDIT: One more thing. I'm pretty sure that when you use Reports Server you should not use Server.MapPath
. Just specify the path as you see it in Reports Server, in your case: /ReportingofUsers/ExpenseClaimReport
. That is assuming that you publish reports to the server.
精彩评论