1

我已经经历了许多链接,但现在我需要能够更好地帮助我的人。我也没有在SSRS的托管和经验方面的经验。如何在asp.net应用程序中本地使用SSRS

在几个网站之后,我在Visual Studio中添加了商业智能 - >“报告项目”,并将其存在于我现有的Asp.net MVC应用程序中。然后,我成功创建了两个可以很好地预览的rdl报告。现在的问题是在asp.net应用程序中使用它们吗?

步骤我所做的是:打开IIS并创建一个新的网站,物理目录

1)“我 SSRS项目的路径”。我现在可以看到该位置,如果我从 IIS浏览此网站。

2)现在来到asp.net代码。我已经添加了查看报告所需的基本代码,但问题是“路径”。我必须定义“本地服务器路径”还是“远程”?两者之间有什么区别。它们是否需要该rdl文件的物理位置?如果它需要物理位置,那么我怎样才能得到它,因为rdl文件位于不同的项目中,并且它不在我的主Web应用程序中。我对此感到困惑。有时如果我尝试给我的应用程序路径,我会得到错误。对于下面的代码,它向我显示了这个错误。

远程名称无法解析: '的reportserver'

下面是项目结构:

enter image description here

这是我在控制器

ReportViewer reportViewer = new ReportViewer 
     { 
      ProcessingMode = ProcessingMode.Remote 
     }; 

     //reportViewer.LocalReport.ReportPath = 
     // Request.MapPath(Request.ApplicationPath) + 
     // "~/Reports/Report3.rdl"; 

     //reportViewer.LocalReport.ReportPath = Path.GetFullPath("~/ReportingProject/Reports/Report3.rdl"); 
     //reportViewer.LocalReport.ReportPath = Path.Combine("~/ReportingProject/Reports/Report3.rdl"); 

     reportViewer.ServerReport.ReportServerUrl = new Uri("http://ReportServer/Reports/report3.rdl"); 


     //string solutiondir = Directory.GetParent(
     // Directory.GetCurrentDirectory()).Parent.FullName; 
     //// may need to go one directory higher for solution directory 
     //return XDocument.Load(solutiondir + "\\" + ProjectBName + "\\Mock\\myDoc.html") 

     reportViewer.Width = Unit.Percentage(100); 


     reportViewer.LocalReport.DataSources.Add(new 
      ReportDataSource("DataSet1", objList)); 

     reportViewer.LocalReport.Refresh(); 

     ViewBag.ReportViewer = reportViewer; 
+1

您需要使用'ReportServer URL',而不是'Reports URL'。 'http:// servername/ReportServer/report3.rdl'如果您在报告管理器中没有rdl扩展名,那么您不需要它在URL字符串中。 –

+0

即使这样做,它也不起作用。 reportViewer.ServerReport.ReportServerUrl = new Uri(“http://localhost/reportserver/report3.rdl”); 连接到报告服务器的尝试失败。检查您的连接信息并确认报表服务器是兼容版本。 客户端发现响应内容类型为'',但预计为'text/xml'。请求失败,返回空的响应。 – Sandy

回答

相关问题