power bi报表服务器_如何将Power BI Report Server报表嵌入ASP.Net Web应用程序

power bi报表服务器

Every once in a while, teams from different functional areas of the business (i.e. business intelligence, software development, web development etc.) would join forces to form a cross-functional development team with a common goal of integrating a business intelligence artefact such as a SQL Server Reporting Services (SSRS) report into a front-end web application. There are many reasons for forming such a partnership including a lack of report-development skill by web developers, BI team owns a better reporting tool for data visualization, or maybe to prevent the software team from “reinventing the wheel” by developing a report that has already been produced elsewhere.

每隔一段时间,来自业务不同职能领域(即商业智能,软件开发,Web开发等)的团队将联手组成一个跨职能的开发团队,其共同目标是整合诸如SQL Server Reporting Services (SSRS)报告到前端Web应用程序。 建立这种伙伴关系的原因有很多,包括Web开发人员缺乏报表开发技能,BI团队拥有更好的数据可视化报表工具,或者可能是通过开发报表来防止软件团队“重塑方向”。已经在其他地方生产了。

Regardless of the reasons for forming cross-functional teams, you would often find that whilst many tutorials have been written about the integration of Power BI Service with .Net applications, there is currently very limited content on the internet pertaining to embedding the on-prem version of Power BI Service (known as Power BI Report Server) reports into .Net applications.

无论组建跨职能团队的原因是什么,您通常会发现,尽管已经撰写了许多有关Power BI Service与.Net应用程序集成的教程,但互联网上目前有关嵌入本地内容的内容非常有限版本的Power BI服务 (称为Power BI报表服务器 )将报表导入.Net应用程序。

I was recently involved in a project that required an integration of a Power BI Report Server dashboard with an ASP.NET MVC application. As you can imagine, having so limited content on the internet relating to this type of integration meant that my team and I had to think out of the box and play around with a few ideas to get the project delivered but we managed to complete the project and, in this article, I will share my limited expertise on how you can go about embedding a Power BI Report Server reports with ASP.NET web applications.

我最近参与了一个项目,该项目需要将Power BI Report Server仪表板与ASP.NET MVC应用程序集成在一起。 可以想像,与此类集成相关的互联网内容非常有限,这意味着我和我的团队必须开箱即用,并想出一些想法来交付项目,但我们设法完成了该项目并且,在本文中,我将分享我有限的专业知识,介绍如何将Power BI Report Server报表嵌入ASP.NET Web应用程序。

将SSRS报告嵌入ASP.NET网站 (Embed SSRS Report into an ASP.NET Website)

In a way, this article is really a comparative piece between the ease at which web developers used to embed SSRS reports into their ASP.NET applications versus the challenges of doing the same thing but against a Power BI Report Server report. Thus, it is only fitting that before we proceed, we first look at how one went about integrating an SSRS report with ASP.NET applications.

从某种意义上说,本文确实是Web开发人员过去将SSRS报表嵌入其ASP.NET应用程序的难易程度与针对Power BI Report Server报表进行相同操作所面临的挑战之间的比较。 因此,在继续之前,我们首先要看看如何将SSRS报告与ASP.NET应用程序集成。

There are plenty of resources over the internet that gives you a step-by-step guideline on how to embed an SSRS report into an ASP.NET web application. Generally, the trick is twofold – (assuming that you have already developed and deployed an SSRS report):

Internet上有大量资源,可为您提供有关如何将SSRS报告嵌入ASP.NET Web应用程序的分步指南。 通常,技巧是双重的-(假设您已经开发并部署了SSRS报告):

  1. Download and Install ReportViewer Control

    下载并安装ReportViewer控件

    In order for an SSRS report to be successfully rendered in a web application, the web page must make use of the rsweb:ReportViewer element which references the assembly file Microsoft.ReportViewer.WebForms.dll. There are several ways that you can go about installing this assembly file, but the safest way would be to install it as a NuGet package.

    为了使SSRS报告能够在Web应用程序中成功呈现,网页必须使用rsweb:ReportViewer元素,该元素引用了程序集文件Microsoft.ReportViewer.WebForms.dll 。 您可以通过多种方法来安装此程序集文件,但最安全的方法是将其安装为NuGet软件包 。

  2. Create a web page to embed report

    创建网页以嵌入报告

    Once installation of the assembly file is complete, you can then embed an SSRS report into an ASP.Net page by providing details of the report’s server name, processing mode, and file location as indicated in Figure 1.

    程序集文件的安装完成后,您可以通过提供报告的服务器名称,处理模式和文件位置的详细信息,将SSRS报告嵌入到ASP.Net页中, 如图1所示

    power bi报表服务器_如何将Power BI Report Server报表嵌入ASP.Net Web应用程序_第1张图片

    Figure 1
    图1

    Figure 2 gives us a preview of the web page we configured in Figure 1. As it can be seen, our sample SSRS report has successfully been embedded into the Default.aspx page.

    图2提供了我们在图1中配置的网页的预览。 可以看出,我们的示例SSRS报告已成功嵌入到Default.aspx页面中。

    power bi报表服务器_如何将Power BI Report Server报表嵌入ASP.Net Web应用程序_第2张图片

    Figure 2
    图2

将Power BI Report Server报表嵌入ASP.NET网站 (Embedding Power BI Report Server Report into ASP.NET Website)

Although the newer version of Report Server Configuration Manager has been modified to support configuration of both SSRS Report Server and Power BI Report Server, as shown in Figure 3, the ReportViewer control continues not to support the rendering of Power BI Report Server reports.

尽管已对新版本的Report Server Configuration Manager进行了修改,以支持SSRS Report ServerPower BI Report Server的配置如图3所示,但是ReportViewer控件仍然不支持Power BI Report Server报表的呈现。

power bi报表服务器_如何将Power BI Report Server报表嵌入ASP.Net Web应用程序_第3张图片

To demonstrate this limitation, I have created and successfully deployed a sample Power BI Report Server report as shown in Figure 4.

为了演示此限制,我创建并成功部署了一个示例Power BI Report Server报告, 如图4所示。

power bi报表服务器_如何将Power BI Report Server报表嵌入ASP.Net Web应用程序_第4张图片

I next updated the links from my sample web application to point to my Power BI Report Server report as shown in Figure 5.

接下来,我更新了示例Web应用程序中的链接,以指向Power BI Report Server报告, 如图5所示。

power bi报表服务器_如何将Power BI Report Server报表嵌入ASP.Net Web应用程序_第5张图片

This time when I run my ASP.NET web application, I receive an error message citing that an item of type Power BI Report Server report is not supported as shown in Figure 6.

这次,当我运行ASP.NET Web应用程序时,我收到一条错误消息, 指出不支持Power BI Report Server报告类型的项目, 如图6所示。

At this point, it is clear that when it comes to Power BI Report Server reports, we cannot simply reuse the same piece of code that we’ve previously turned to whenever we needed to embed an SSRS report into an ASP.Net web application. We, therefore, need to look out for other options that we can use to successfully embed reports hosted within an instance of Power BI Report Server. Fortunately, since, a Power BI Report Server report is essentially an HTML document, we have numerous HTML tags that we can use in ASP.Net application to embed a report.

至此,很明显,当涉及到Power BI Report Server报表时,无论何时需要将SSRS报表嵌入ASP.Net Web应用程序中时,我们都无法简单地重用以前使用的同一段代码。 因此,我们需要寻找可用于成功嵌入Power BI Report Server实例中托管的报表的其他选项。 幸运的是,由于Power BI Report Server报表本质上是HTML文档,因此我们可以在ASP.Net应用程序中使用许多HTML标记来嵌入报表。

选项#1:使用         
        
    

When you next run your web app, you will notice that the filter panel has been removed as shown in Figure 9.

下次运行Web应用程序时,您会注意到过滤器面板已被删除, 如图9所示。

power bi报表服务器_如何将Power BI Report Server报表嵌入ASP.Net Web应用程序_第8张图片

翻译自: https://www.sqlshack.com/how-to-embed-a-power-bi-report-server-report-into-an-asp-net-web-application/

power bi报表服务器

你可能感兴趣的:(power bi报表服务器_如何将Power BI Report Server报表嵌入ASP.Net Web应用程序)