在 SharePoint 网站上部署 SQL Server Reporting Services 报表查看器 Web 部件Deploy the SQL Server Reporting Services Report Viewer web part on a SharePoint site

适用对象:APPLIES TO: SQL Server 2016 Reporting Services 及更高版本 Power BI 报表服务器 SharePoint 2013 及更高版本 SharePoint Online SQL Server 2016 Reporting Services 及更高版本 Power BI 报表服务器 SharePoint 2013 及更高版本 SharePoint Online

报表查看器 Web 部件是一个自定义 Web 部件,可用于查看 SharePoint 网站中的 SQL Server Reporting Services(本机模式)报表。The Report Viewer web part is a custom web part that can be used to view SQL Server Reporting Services (native mode) reports within your SharePoint site. 可以使用此 Web 部件在报表服务器上查看、导航、打印和导出报表。You can use the web part to view, navigate, print, and export reports on a report server. 报表查看器 Web 部件与由 SQL Server Reporting Services 报表服务器或 Power BI 报表服务器处理的报表定义 (.rdl) 文件相关联。The Report Viewer web part is associated with report definition (.rdl) files that are processed by a SQL Server Reporting Services report server or a Power BI Report Server. 此报表查看器 Web 部件不能用于 Power BI 报表服务器中托管的 Power BI 报表。This Report Viewer web part cannot be used with Power BI reports hosted in Power BI Report Server.

使用以下说明以手动部署解决方案包,该解决方案包会将报表查看器 Web 部件添加到 SharePoint Server 2013、SharePoint Server 2016 或 SharePoint Server 2019 环境中。Use the following instructions to manually deploy the solution package that add the Report Viewer web part to a SharePoint Server 2013, SharePoint Server 2016, or SharePoint Server 2019 environment. 部署解决方案是配置 Web 部件的必需步骤。Deploying the solution is a required step for configuring the web part.

报表查看器 Web 部件是独立的解决方案包,不与 SQL Server Reporting Services 的 SharePoint 集成模式相关联。The Report Viewer web part is a standalone solution package and is not associated with SharePoint integrated mode for SQL Server Reporting Services.

要求Requirements

重要

从版本“15.X.X.X”开始,可以并行安装 ReportViewerWebPart 和现有的 Reporting Services SharePoint 集成模式共享服务应用程序。Starting with version "15.X.X.X" you can install the ReportViewerWebPart side by side with your existing Reporting Services SharePoint integrated mode shared service applications. 此次 .wsp 解决方案更新,我们引入了新的文件,必须分别使用 Uninstall-SPSolution 和 Install-SPSolution cmdlet 撤销之前的解决方案和重复部署新的 .wsp。With this update of the .wsp solution we introduced new files and the previous solution must be retracted and the new .wsp redeployed by using the Uninstall-SPSolution and Install-SPSolution cmdlets, respectively.

支持的 SharePoint Server 版本:Support SharePoint Server versions:

  • SharePoint Server 2019SharePoint Server 2019
  • SharePoint Server 2016SharePoint Server 2016
  • SharePoint Server 2013SharePoint Server 2013

支持的 Reporting Services 版本:Support Reporting Services versions:

  • SQL Server 2008 Reporting Services(本机模式)和更高版本。SQL Server 2008 Reporting Services (Native mode) and later.
  • Power BI 报表服务器Power BI Report Server

下载报表查看器 Web 部件解决方案包Download the Report Viewer web part solution package

可从 Microsoft 下载中心下载报表查看器 Web 部件。The Report Viewer web part is available on the Microsoft Download Center.

下载报表查看器 Web 部件解决方案包Download Report Viewer web part solution package

部署场解决方案Deploy the farm solution

本部分演示如何将解决方案包部署到 SharePoint 场。This section shows you how to deploy the solution package to your SharePoint farm. 此任务仅需执行一次。This task only needs to be performed once.

  1. 在 SharePoint Server 上,使用“以管理员身份运行”选项打开 SharePoint 命令行管理程序。On a SharePoint server, open a SharePoint Management Shell using the Run as Administrator option.

  2. 运行 Add-SPSolution 以添加场解决方案。Run Add-SPSolution to add the farm solution.

    Add-SPSolution -LiteralPath "{path to file}\ReportViewerWebPart.wsp"
    

    该 cmdlet 返回解决方案的名称、其解决方案 ID 和 Deployed=False。The cmdlet returns the name of the solution, its solution ID, and Deployed=False. 在下一步骤中,您将部署解决方案。In the next step, you will deploy the solution.

  3. 运行 Install-SPSolution cmdlet 以部署场解决方案。Run the Install-SPSolution cmdlet to deploy the farm solution.

    SharePoint 2013SharePoint 2013

    Install-SPSolution -Identity ReportViewerWebPart.wsp -CompatibilityLevel "14,15" -GACDeployment -WebApplication {URL to web application}
    

    SharePoint Server 2016 和 2019SharePoint Server 2016 and 2019

    Install-SPSolution -Identity ReportViewerWebPart.wsp -GACDeployment -WebApplication {URL to web application}
    

激活功能Activate feature

  1. 在 SharePoint 网站中,选择左上角的“齿轮”图标,然后选择“网站设置” 。In your SharePoint site, select the gear icon in the upper left and select Site Settings.

    齿轮图标中的“网站设置”。

    默认情况下,通过端口 80 访问 SharePoint Web 应用程序。By default, SharePoint web applications are accessed through port 80. 这意味着通常可通过输入 https:// 打开根网站集以访问 SharePoint 网站。This means that you can often access a SharePoint site by entering https:// to open the root site collection.

  2. 在“网站集管理”中,选择“网站集功能” 。In Site Collection Administration, select Site collection features.

  3. 向下滚动页面,直至找到“报表查看器 Web 部件”功能为止。Scroll down the page until you find the Report Viewer web part Feature.

  4. 选择“激活”。Select Activate.

    激活报表查看器 Web 部件功能

  5. 通过打开各网站并单击“网站操作”来对其他网站集重复上述操作。Repeat for additional site collections by opening each site and clicking Site Actions.

或者,还可使用 PowerShell 通过 Enable-SPFeature cmdlet 在所有网站上启用此功能。Optionally, you can also use PowerShell to enable this feature on all sites using the Enable-SPFeature cmdlet.

Get-SPWebApplication "<web application url>" | Get-SPSite -Limit ALL | 
        ForEach-Object {
            Write-Host "Enabling feature for $($_.URL)"
            Enable-SPFeature -identity "ReportViewerWebPart" -URL $_.URL -ErrorAction Continue
        }

删除解决方案Remove the solution

尽管 SharePoint 管理中心提供了解决方案收回,但除非是在系统地解决安装问题或修补部署问题,否则便无需收回 ReportViewerWebPart.wsp 文件。Although SharePoint Central Administration provides solution retraction, you do not need to retract the ReportViewerWebPart.wsp file unless you are systematically troubleshooting an installation or patch deployment problem.

  1. 在 SharePoint 管理中心的“系统设置”中,选择“管理场解决方案” 。In SharePoint Central Administration, in System Settings, select Manage farm solutions.

  2. 选择“ReportViewerWebPart.wsp”。Select ReportViewerWebPart.wsp.

  3. 选择“收回解决方案”。Select Retract Solution.

从网站设置中删除 Web 部件Remove the web part from Site settings

收回解决方案不会从 SharePoint 网站内的 Web 部件列表中删除报表查看器 Web 部件。Retracting the solution does not remove the Report Viewer web part from the list of web parts within your SharePoint site. 若要删除报表查看器 Web 部件,请执行以下操作。To remove the Report Viewer web part, do the following.

  1. 在 SharePoint 网站中,选择左上角的“齿轮”图标,然后选择“网站设置” 。In your SharePoint site, select the gear icon in the upper left and select Site Settings.

    齿轮图标中的“网站设置”。

    默认情况下,通过端口 80 访问 SharePoint Web 应用程序。By default, SharePoint web applications are accessed through port 80. 这意味着通常可通过输入 https:// 打开根网站集以访问 SharePoint 网站。This means that you can often access a SharePoint site by entering https:// to open the root site collection.

  2. 在“Web 设计器库”下,选择“Web 部件” 。Under Web Designer Galleries, select web parts.

  3. 选择“ReportViewerNativeMode.dwp”旁边的“编辑图标” 。Select the edit icon next to ReportViewerNativeMode.dwp. 它可能没有列在结果的第一页上。It may not be listed on the first page of results.

  4. 选择“删除项”。Select Delete Item.

    编辑并删除报表查看器本机模式 Web 部件

可以使用 PowerShell 尝试删除 Web 部件,但没有直接的命令用于此操作。Deletion of the web part can be attempted by using PowerShell, but there is not a direct command for it. 有关脚本示例,请参阅 How to delete web parts from the web part Gallery(如何从 Web 部件库中删除 Web 部件)。For a script example, see How to delete web parts from the web part Gallery.

支持的语言Supported languages

Web 部件支持以下语言:The following languages are supported with the web part:

  • 英语 (en)English (en)
  • 德语 (de)German (de)
  • 西班牙语 (sp)Spanish (sp)
  • 法语 (fr)French (fr)
  • 意大利语 (it)Italian (it)
  • 日语 (ja)Japanese (ja)
  • 韩语 (ko)Korean (ko)
  • 葡萄牙语 (pt)Portuguese (pt)
  • 俄语 (ru)Russian (ru)
  • 中文(简体 - zh-HANS 和 zh-CHS)Chinese (Simplified - zh-HANS and zh-CHS)
  • 中文(繁体 - zh-HANT 和 zh-CHT)Chinese (Traditional - zh-HANT and zh-CHT)

疑难解答Troubleshoot

  • 如果已配置 SharePoint 集成模式,则卸载 SSRS 时出错:Error when uninstalling SSRS if you have SharePoint integrated mode configured:

    Install-SPRSService:[A] Microsoft.ReportingServices.SharePoint.SharedService.Service.ReportingWebService 无法强制转换为 [B]Microsoft.ReportingServices.SharePoint.SharedService.Service.ReportingWebService。Install-SPRSService : [A] Microsoft.ReportingServices.SharePoint.SharedService.Service.ReportingWebService cannot be cast to [B]Microsoft.ReportingServices.SharePoint.SharedService.Service.ReportingWebService. A 类型来自“C:\Windows\assembly\GAC_MSIL\Microsoft.Reporting Services.SharePoint.SharedService.dll”位置处上下文“Default”中的“Microsoft.ReportingServices.SharePoint.SharedService,Version=14.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91”。Type A originates from 'Microsoft.ReportingServices.SharePoint.SharedService,Version=14.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' in the context 'Default' at location 'C:\Windows\assembly\GAC_MSIL\Microsoft.Reporting Services.SharePoint.SharedService.dll'. B 类型来自“C:\Windows\assembly\GAC_MSIL\Microsoft.Reporting Services.SharePoint.SharedService.dll”位置处上下文“Default”中的“Microsoft.ReportingServices.SharePoint.SharedService,Version=12.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91”。Type B originates from 'Microsoft.ReportingServices.SharePoint.SharedService,Version=12.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' in the context 'Default' at location 'C:\Windows\assembly\GAC_MSIL\Microsoft.Reporting Services.SharePoint.SharedService.dll'.

    解决方案:Solution:

    1. 删除报表查看器 Web 部件Remove the Report Viewer web part
    2. 卸载 SSRSUninstall SSRS
    3. 重新安装报表查看器 Web 部件Reinstall the Report Viewer web part
  • 如果已配置 SharePoint 集成模式,则尝试升级 SharePoint 时出错:Error when trying to upgrade SharePoint if you have SharePoint integrated mode configured:

    无法加载文件或程序集“Microsoft.ReportingServices.Alerting.ServiceContract, Version=14.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91”或其依赖项之一。Could not load file or assembly 'Microsoft.ReportingServices.Alerting.ServiceContract, Version=14.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. 系统找不到指定的文件。The system cannot find the file specified. 00000000-0000-0000-0000-00000000000000000000-0000-0000-0000-000000000000

    解决方案:Solution:

    1. 删除报表查看器 Web 部件Remove the Report Viewer web part
    2. 卸载 SSRSUninstall SSRS
    3. 重新安装报表查看器 Web 部件Reinstall the Report Viewer web part

后续步骤Next steps

在部署并激活报表查看器 Web 部件后,可将 Web 部件添加到 SharePoint 页面。After the Report Viewer web part has been deployed and activated, you can add the web part to a SharePoint page. 有关详细信息,请参阅将报表查看器 Web 部件添加到 SharePoint 页面For more information, see Add Report Viewer web part to a SharePoint page.

更多疑问?More questions? 请访问 Reporting Services 论坛Try asking the Reporting Services forum