SSRS使用.Net Core 3.1 MVC应用程序进行报告



我正在尝试在.Net Core 3.1 MVC应用程序中显示SSRS报告。

我尝试实施中提到的方法

https://alanjuden.com/2016/11/10/mvc-net-core-report-viewer/?unapproved=58532&审核散列=321d5350c96d2fcf83baa4c939bdf53#comment-58532

public class ReportsController : AlanJuden.MvcReportViewer.ReportController
{
protected override ICredentials NetworkCredentials
{
get
{
//Custom Domain authentication (be sure to pull the info from a config file)
return new System.Net.NetworkCredential("username", "password");
//Default domain credentials (windows authentication)
//return System.Net.CredentialCache.DefaultNetworkCredentials;
}
}
protected override string ReportServerUrl
{
get
{
//You don't want to put the full API path here, just the path to the report server's ReportServer directory that it creates (you should be able to access this path from your browser: 
return "https://YourReportServerUrl.com/ReportServer/ReportExecution2005.asmx";
}
}
public IActionResult ProcessReport()
{
var model = this.GetReportViewerModel(Request);
model.ReportPath = "reportPath";
return RedirectToAction("ReportViewer", model);
}}

但它不适用于最新的框架。我在运行项目时遇到以下错误-错误屏幕截图

感谢您的帮助。谢谢

同样的事情发生在我身上,在我的情况下,我需要安装告诉你安装的同一个软件包

Install-Package System.ServiceModel.Http -Version 4.1.0

或者在nuget中查找包System.ServiceModel.Http

我用最新的.NET Core尝试了不同的解决方案,包括您提到的Alan Juden的解决方案。然而,对我来说,最简单的方法是使用Microsoft的Report Viewer控件创建一个普通的.NET WebForms网站。它仍然有很多代码,但这是可靠的,因为报表查看器控件已经存在多年了。

在我的例子中,它从Angular UI显示SSRS报告,但MVC或任何其他Web UI也可以使用,因为您实际上会重定向/导航到另一个url(WebForms aspx页面(。

更多详细信息请点击此处。

最新更新