简体   繁体   English

ASP.NET Core MVC 应用程序中的 Microsoft LocalReport (rdl)

[英]Microsoft LocalReport (rdl) in ASP.NET Core MVC App

I am running a project with ASP.NET Core (2.1) MVC.我正在使用 ASP.NET Core (2.1) MVC 运行一个项目。 In our company we do have a lot of work done with SQL Report Builder (rdlc and rdl files).在我们公司,我们确实使用 SQL Report Builder(rdlc 和 rdl 文件)完成了很多工作。 Therefore we wanted to use a "one the fly" mechanism to generate PDF Files with the ReportBuilder technology in the asp.net core mvc webapp.因此,我们希望在 asp.net core mvc webapp 中使用“one the fly”机制通过 ReportBuilder 技术生成 PDF 文件。

I tried the same nuget packages we are using in .net Framework (asp.net API and desktop app) but they are not working.我尝试了我们在 .net Framework(asp.net API 和桌面应用程序)中使用的相同 nuget 包,但它们不起作用。 The packages I tried are:我试过的包是:

  • Microsoft.ReportingServices.ReportViewerControl.Winforms Microsoft.ReportingServices.ReportViewerControl.Winforms
  • Microsoft.ReportingServices.ReportViewerControl.Webforms Microsoft.ReportingServices.ReportViewerControl.Webforms

The problem there is that they are using System.Web which I cannot include in .net Core apps, do I?问题是他们使用的 System.Web 我不能包含在 .net Core 应用程序中,是吗?

I googled for any solution but did not find a lot of helpfull material.我用谷歌搜索任何解决方案,但没有找到很多有用的材料。 I am also ware of that Microsoft purchased a product to get the work done: https://blogs.msdn.microsoft.com/sqlrsteamblog/2018/04/02/microsoft-acquires-report-rendering-technology-from-forerunner-software/我也知道微软购买了一个产品来完成工作: https : //blogs.msdn.microsoft.com/sqlrsteamblog/2018/04/02/microsoft-acquires-report-rendering-technology-from-forerunner-软件/

And I already read this article about a similar problem: RDLC Local report viewer for ASP.NET Core and Angular(>2.0)我已经阅读了这篇关于类似问题的文章: RDLC Local report viewer for ASP.NET Core and Angular(>2.0)

Do we have the wrong technology setup in mind or is this even not support at all.我们是否有错误的技术设置,或者根本不支持。 I found some other package ( https://www.nuget.org/packages/AlanJuden.MvcReportViewer.NetCore/ ) which are working with html to render a report.我发现了一些其他包( https://www.nuget.org/packages/AlanJuden.MvcReportViewer.NetCore/ ),它们正在使用 html 来呈现报告。 But we really want to use the rdl files但我们真的想使用 rdl 文件

Any informations and suggestions are greatly appreciated.非常感谢任何信息和建议。

In the end we came up with a totally other approach.最后我们想出了一个完全不同的方法。

We just created a new Application called "DocumentService" on .NET Framework running as a Service on a Windows Server.我们刚刚在 Windows 服务器上作为服务运行的 .NET Framework 上创建了一个名为“DocumentService”的新应用程序。 The service was checking a database if there are new jobs in the database queue and if so, it generates the pdf result and stores it in the database.该服务正在检查数据库队列中是否有新作业,如果有,它会生成 pdf 结果并将其存储在数据库中。

So the web application was not longer responsible for creating the pdf, it only added a new line in the database so mark that a new document should be created.因此 Web 应用程序不再负责创建 pdf,它只在数据库中添加了一个新行,以便标记应该创建一个新文档。 The DocumentService app then generated the document and the web app could access the data in the database.然后 DocumentService 应用程序生成文档,Web 应用程序可以访问数据库中的数据。

We can use this "DocumentService" in other part of our application landscape and therefore the effor was worth it.我们可以在应用程序环境的其他部分使用这个“DocumentService”,因此付出的努力是值得的。 It app is also multithreaded and working pretty fast and well.它的应用程序也是多线程的,并且运行速度非常快。

No you can't include System.Web.不,您不能包含 System.Web。 I had same problem and solved it with AspNetCore.Reporting.我遇到了同样的问题并使用 AspNetCore.Reporting 解决了它。 You can download this from NuGet.你可以从 NuGet 下载它。 This can be useful: https://www.dotnetcurry.com/aspnet/844/aspnet-ssrs-reports-programmatically-html这可能很有用: https : //www.dotnetcurry.com/aspnet/844/aspnet-ssrs-reports-programmatically-html

Well, depends.嗯,取决于。 If you want it inside your application, and don't mind generating the report in iframe it's possible.如果你想在你的应用程序中使用它,并且不介意在 iframe 中生成报告,那是可能的。 Or you can always open it in a new tab.或者您可以随时在新选项卡中打开它。 Only problem is that you have to know the link to the report.唯一的问题是您必须知道报告的链接。 I did it like that in my company's program.我在我公司的程序中就是这样做的。 If you want to know more, just ask me, but officially ASP.NET Core doesn't support reporting如果你想了解更多,就问我吧,但官方 ASP.NET Core 不支持报告

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM