如何解决带有.Net Core 3.1 MVC应用程序的SSRS报告
我正在尝试在.Net Core 3.1 MVC应用程序中显示SSRS报告。
我试图实施
中提到的方法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);
}}
,但不适用于最新框架。 我在运行项目时遇到以下错误-Error screenshot
感谢您的帮助。 谢谢!
解决方法
同样的事情发生在我身上,就我而言,我需要安装一个告诉您安装的软件包
Install-Package System.ServiceModel.Http -Version 4.1.0
或在nuget中查找软件包System.ServiceModel.Http
我使用最新的.NET Core尝试了不同的解决方法,包括您从Alan Juden提到的方法。但是,对我而言,最简单的方法是使用Microsoft的Report Viewer控件创建一个普通的.NET WebForms站点。它仍然是很多代码,但这很可靠,因为Report Viewer控件已经存在很多年了。
在我的情况下,它显示的是来自Angular UI的SSRS报告,但同样适用于MVC或任何其他Web UI,因为您实际上将重定向/导航到另一个URL(WebForms aspx页面)。
更多详细信息here。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。