Crystal Reports Online Training

Learn Online, Anytime, Anywhere

Step-by-step online tutorials.

19.14 Deploying an ASP.NET Application

Deploying an ASP.NET Application

Deploying a web application is very similar to deploying a Windows application. As far as Crystal Reports is concerned, the primary difference is that the project is going to be installed on a web server.

When deploying to a web server for the first time, make sure that the ASPNET user has full rights to the \Windows\Temp folder. Crystal Reports reads and writes temporary files to this folder while generating reports. If you’re deploying to Windows Server 2003, use the NetworkServices account instead.

To create a deployment project for your web application, first open your application in design mode. Then select File > New > Project. This opens the New Project dialog box.

Open the Other Project Types node and select Setup and Deployment. On the right side, click the Web Setup Project template. At the bottom of the dialog box, give it an appropriate name and set the file location. You should also select the option Add To Solution so that the setup project stays within the same solution as your reporting application. This is shown in Figure 19-8.





Figure 19-8. New Project window for a Web Setup Project.

This adds the setup project to the current application’s Solution Explorer window. Right-click on setup project’s name and select Add > Project Output. This opens the Add Project Output Group window, shown in Figure 19-9.





Figure 19-9. Adding content files to the web deployment project.

Select the Content option and click the OK button. Unlike the Windows setup process, selecting the Content option automatically adds every report in your web site to the deployment output. To confirm this, look for the Content Files node under the setup project’s name and right-click on it. Select the Outputs menu option and you should see the report listed as one of the output files.

If the reports aren’t listed in the Solution Explorer window (e.g. they are stored in a common reporting library), you can manually add them to the deployment project. Right-click on the setup project’s name and select Add > File. Browse to where the reports are located and select them. This adds them the deployment project’s output.

Once all the report files are added to the project, rebuild the project to create the setup files and use them to install the application on the client computer.

Question: I deployed my web application to a new server, but the Crystal Reports viewer is missing its icons. How do I install them on the server?

Answer: If the server doesn’t have the Crystal Reports icons installed, you have to manually copy them from your development computer to the web server. Each version of Crsytal Reports puts the icons in different folders so that there aren’t versioning issues. Look on your computer in the following folders and copy them to the same location on your web server.

Visual Studio .NET 2005 Folder:

File path when using IIS

C:\Inetpub\wwwroot\aspnet_client\system_web\2_0_50727\CrystalReportWebFormViewer3

File path when using ASP.NET Development Server:

[Windows folder]\Microsoft.NET\Framework\v2.0.50727\ASP.NETClientFiles\CrystalReportWebFormViewer3
Visual Studio .NET 2008 Folder:

File path when using IIS

C:\Inetpub\wwwroot\aspnet_client\system_web\2_0_50727\CrystalReportWebFormViewer4

File path when using ASP.NET Development Server:

[Windows folder]\Microsoft.NET\Framework\v2.0.50727\ASP.NETClientFiles\CrystalReportWebFormViewer4

Question: I’m going to use a third-party company to host my website. How do I deploy my reports on their server?

Answer: Most third-party hosting companies don’t support Crystal Reports on their web servers. Since the Crystal Reports components are not 100% managed code, you can’t transfer it via FTP to your site and expect it work. The only way to print reports in this scenario is to talk to your hosting company and ask them to install the Crystal Reports runtime for your site. Unfortunately, it is highly unlike that this will happen due to security concerns (not to mention licensing issues).