Use ReportViewer in a Web Site Hosted in Azure
Mis à jour: avril 2014
You can build a Windows Azure Web site with the Visual Studio ReportViewer control that displays a report stored on an Windows Azure Virtual Machine. The ReportViewer control is in a Web application that you build using the ASP.NET Web application template.
|The ASP.NET MVC Web Application templates do not support the ReportViewer control.|
To incorporate ReportViewer into your Windows Azure Web site, you need to complete the following tasks.
Adding Assemblies to the Deployment Package.
Configuring Authentication and Authorization.
Publish the ASP.NET Web application to Azure
For instructions on publishing an ASP.NET Web application to Azure, see How to: Migrate and Publish a Web Application to Azure from Visual Studio.
Important If the Add Azure Deployment Project or Add Azure Cloud Service Project command does not appear in the shortcut menu in Solution Explorer, you may need to change the Target framework for the project to .NET Framework 4. The two commands provide essentially the same functionality. One or the other command will appear in the shortcut menu depending on which version of the Windows Azure SDK you have installed.
Review the prerequisites described in Getting Started Guide for Application Developers (SQL Reporting). You must have published reports on a SQL Reporting report server.
|ReportViewer controls are shipped with Visual Studio, Standard Edition or above. If you are using the Web Developer Express Edition, you must install the Microsoft Report Viewer Redistributable Package to use the ReportViewer runtime features.|
|ReportViewer configured in local processing mode is not supported in Windows Azure.|
When you host your ASP.NET application on-premise, the ReportViewer assemblies are usually installed directly in the global assembly cache (GAC) of the IIS server during Visual Studio installation, and can be accessed directly by the application. However, when you host your ASP.NET application in the cloud, Windows Azure does not allow anything to be installed into the GAC, so you must make sure the ReportViewer assemblies are available locally for your application. You can do this by adding references to them in your project and configure them to be copied locally.
In remote processing mode, the ReportViewer control uses the following assemblies:
Microsoft.ReportViewer.WebForms.dll Contains the ReportViewer code, which you need to use ReportViewer in your page. A reference for this assembly is added to your project when you drop a ReportViewer control onto an ASP.NET page in your project.
Microsoft.ReportViewer.Common.dll Contains classes used by the ReportViewer control at run time. It is not automatically added to your project.
To add a reference to Microsoft.ReportViewer.Common
Right-click your project’s References node and select Add Reference, select the assembly in the .NET tab, and click OK.
To make the assemblies locally accessible by your ASP.NET application
In the References folder, click the Microsoft.ReportViewer.Common assembly so that its properties appear in the Properties pane.
In the Properties pane, set Copy Local to True.
Repeat steps 1 and 2 for Microsoft.ReportViewer.WebForms.
To get ReportViewer Language Pack
Install the appropriate Microsoft Report Viewer 2012 Runtime redistributable package from Microsoft Download Center (http://go.microsoft.com/fwlink/?LinkId=317386).
Select the language from the dropdown list and the page gets redirected to the corresponding download center page.
Click Download to start the download of ReportViewerLP.exe.
After you download ReportViewerLP.exe, click Run to install immediately, or click Save to save it to your computer. If you click Save, remember the name of the folder where you save the file.
Locate the folder where you saved the file. Right-click ReportViewerLP.exe, click Run as administrator, and then click Yes.
After running ReportViewerLP.exe, you will see the c:\windows\assembly has the resource files Microsoft.ReportViewer.Webforms.Resources and Microsoft.ReportViewer.Common.Resources.
To configure for localized ReportViewer control
Download and install the Microsoft Report Viewer 2012 Runtime redistributable package by following the above specified instructions.
Create <language> folder in the project and copy the associated resource assembly files there. The resource assembly files to be copied are: Microsoft.ReportViewer.Webforms.Resources.dll and Microsoft.ReportViewer.Common.Resources.dll.
Select the resource assembly files, and in the Properties pane, set Copy to Output Directory to “Copy always”.
Set the Culture & UICulture for the web project. For more information about how to set the Culture and UI Culture for an ASP.NET Web page, see How to: Set the Culture and UI Culture for ASP.NET Web Page Globalization (http://go.microsoft.com/fwlink/?LinkId=237461).
The ReportViewer needs to use proper credentials to authenticate with the report server, and the credentials must be authorized by the report server to access the reports you want. For more information, follow the steps in Authentication to SQL Reporting in Getting Started Guide for Application Developers (SQL Reporting).
RéférenceUseful Links for SQL Reporting
Autres ressourcesGetting Started Guide for Application Developers (SQL Reporting)