Crystal Reports for Visual Studio 2010 Error
Asked Answered
E

9

17

I am trying to run a crystal report from my web application which was built using ASP.NET 4.0 and Visual Studio 2010. I have installed the following from the SAP site (http://www.businessobjects.com/jump/xi/crvs2010/us2_default.asp)

1) SAP Crystal Reports, version for Visual Studio 2010 - Standard EXE installation package which installs the software into the Visual Studio IDE.

2) SAP Crystal Reports runtime engine for .NET Framework 4 (64-bit)

I have a page called Reports.aspx in which I have a crystal report viewer control

 <CR:CrystalReportViewer ID="rptViewer" runat="server" AutoDataBind="true" />

In the Reports.aspx.cs file I have the following code:

protected override void OnPreRender(EventArgs e)
{
    ReportDocument report = new ReportDocument();
    var path = Server.MapPath("Reports/Sample.rpt");
    report.Load(path);
    report.SetDatabaseLogon("username", "password", "servername", "databasename");
    rptViewer.ReportSource = report;
}

On the report.Load(path) line I get the following error:

Unsupported Operation. A document processed by the JRC engine cannot be opened in the C++ stack.

How can I fix this?

Exuberance answered 28/11, 2010 at 0:55 Comment(0)
I
10

make sure the report is in app_code folder initialize a new instance of it instead of initializing a reportdocument and loading the report in it.

Sample report = new Sample();

this worked for me

Illegitimacy answered 28/11, 2010 at 14:39 Comment(0)
D
14

I also got into the same problem my problem was report path was not valid, May be you have same problem , check Server.MapPath("Reports/Sample.rpt") returning valid path ?

Daryn answered 7/12, 2010 at 8:49 Comment(3)
Thanks for your answer. I had just run into the same problem. It didn't cross my mind to check that the report files were actually there! D'oh! Attributes on the report files was set to copy=do not copy, so the automated build was not outputting them.Unlikelihood
+1 If the report file is not there you can run into this problem as i didOctopod
@Priyan R - - You seem to have good handle of this. Could you help me with this [link]#22672209Wilhelmstrasse
I
10

make sure the report is in app_code folder initialize a new instance of it instead of initializing a reportdocument and loading the report in it.

Sample report = new Sample();

this worked for me

Illegitimacy answered 28/11, 2010 at 14:39 Comment(0)
A
6

You will need to modify two properties in the .rpt files:

  1. Build Action is set to "Embedded Resource" by default. Change it to "Content".
  2. Copy to Output is set to "Do not copy" by default. Change it to "Copy always".

Rebuild, Build deployment package and Publish. Done!

Aleida answered 15/5, 2012 at 9:5 Comment(1)
I don't think you would want Copy Always while publishing but Build Action to Content works like a charmLermontov
B
5

NOTE: Below, the term "WebSite" refers to actual web site nodes in IIS, NOT a virtual directory within a web site.

Problem Root Cause: There is no "aspnet_client" folder accessible by the application.
This can happen for several reasons:

  1. Since the SAP CR installer appears to install the aspnet_client folder in the ...\inetpub\wwwroot\ folder, if your Web Site physical path is NOT ...\inetpub\wwwroot, your application will not have access to the aspnet_client folder.
  2. If the aspnet_client folder was moved or deleted from to the top level of your web site's physical path, your IIS application will not have access to the folder.

Problem Solution (For Windows Server 2008 R2)

  1. Go to the IIS manager on your server
  2. Expand the tree view node for the WebSite running your application
  3. Look at the level immediately under the web site node and ensure you see a "aspnet_client" folder.
  4. If you do see the folder, then perhaps this root cause is not the cause of your problem.
  5. If you do NOT see the folder, search the server's hard drive for it and COPY it to the Web Site's Physical path.
  6. Right mouse button click on the Web Site node and click Refresh from the popup Menu
  7. You should now see the aspnet_client folder at the level directly under your web site node and the reports in the application should work.
Bigelow answered 12/9, 2011 at 16:26 Comment(0)
P
3

I ran into this when I converted a web site to a web application. The report would run fine on my dev machine, but not on the server. Then I realized the rpt file was missing on the server!

By default the report files were considered embedded resources and were not copied when the web application was published. I just changed them individually, republished the site, and all was well again.

Philemon answered 2/3, 2011 at 17:20 Comment(0)
L
2

I have also had a report load failure if I have mistakenly left the report file open in crystal reports designer.

Lepido answered 1/7, 2011 at 20:32 Comment(0)
G
2

This error is a real treat, and seems to have many possible antecedents. Fortunately I only wasted a day on my particular variation:

ReportDocument.Load() also makes a local temp copy. (This may only be in the case of a load from a network drive location, I didn't test this in the case of a local load.)

If the user context under which the load occurs does not have authority to create the temp file locally, Load will fail with the same very unhelpful error.


Also, I ended up diagnosing this with Process Monitor. It may be helpful for you as well.

Gubernatorial answered 23/3, 2012 at 21:44 Comment(0)
O
0

Please make sure your report rpt files are in their original folder. I got the same error first, after I "published" my MVC web site to IIS. I didn't realize that "Publish" didn't put rpt files in the package.

Orelu answered 19/5, 2011 at 2:52 Comment(0)
N
0
  1. Re-install the "Crystal report engine" to the server

  2. Build Action set to "Content".

It perfectly worked for me..!

Natant answered 15/2, 2013 at 4:46 Comment(1)
The link you provided was simply the home page to your blog. Please do not include links like that in your answers, or your answers could be deleted as spam. You may use your profile for linking to your site.Puce

© 2022 - 2024 — McMap. All rights reserved.