C# JRC引擎处理的文档无法在C++栈中打开

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10833894/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-09 15:27:09  来源:igfitidea点击:

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

c#asp.netlocalhost

提问by sharad

I have created a crystal report in vs2010 with .net4.0. when I publish the website it throws the error "A document processed by the JRC engine cannot be opened in C++ stack". I published the website in server and I'm trying to access it from client, I did keet the .rpt file in app_code, but again getting the same error. So I created a folder wwwroot and in that folder I kept the asp_client and website folder and I gave the physical path to wwwroot. everything working fine except crystal report. In .cs file code is as follows:

我在 vs2010 中用 .net4.0 创建了一个水晶报告。当我发布网站时,它抛出错误“无法在 C++ 堆栈中打开由 JRC 引擎处理的文档”。我在服务器上发布了网站,我试图从客户端访问它,我确实在 app_code 中保留了 .rpt 文件,但再次遇到相同的错误。因此,我创建了一个文件夹 wwwroot,并在该文件夹中保留了 asp_client 和网站文件夹,并提供了 wwwroot 的物理路径。除了水晶报告,一切正常。在.cs文件中代码如下:

    ReportDocument rptDoc = new ReportDocument();
    DataSetForCrystalReport ds = new DataSetForCrystalReport();
    DataSetForCrystalReport dsHeader = new DataSetForCrystalReport();
    DataTable dt = new DataTable();
    DataTable dtHeader = new DataTable();
    dt.TableName = "dtBill";
    string ReceiptNo = Request.QueryString["ReceiptNo"];
    dt = getAllOrders(ReceiptNo).Tables[0];
    dtHeader = TblcompanysettingsService.GetOrganizationDetails();
    ds.Tables[1].Merge(dt);
    ds.Tables[2].Merge(dtHeader);
    rptDoc.Load(Server.MapPath("crBill.rpt"));
    rptDoc.SetDataSource(ds);
    CrystalReportViewer1.ReportSource = rptDoc;

stack trace of error:

错误堆栈跟踪:

[COMException (0x80041811): Unsupported Operation. A document processed by the JRC engine cannot be opened in the C++ stack.]
   CrystalDecisions.ReportAppServer.ClientDoc.ReportClientDocumentClass.Open(Object& DocumentPath, Int32 Options) +0
   CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.Open(Object& DocumentPath, Int32 Options) +147
   CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.EnsureDocumentIsOpened() +422

[CrystalReportsException: Load report failed.]
   CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.EnsureDocumentIsOpened() +549
   CrystalDecisions.CrystalReports.Engine.ReportDocument.Load(String filename, OpenReportMethod openMethod, Int16 parentJob) +1613
   CrystalDecisions.CrystalReports.Engine.ReportDocument.Load(String filename) +189
   GenerateBill.Page_Load(Object sender, EventArgs e) in e:\ShareFolder\Movie\wwwroot\Website\GenerateBill.aspx.cs:33
   System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +25
   System.Web.UI.Control.LoadRecursive() +71
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3064

回答by sharad

Found out the solution, I was First using Visual Studio 2005 with its own crystal report and then i upraded to VS2010 with seperate crystal report which i downloaded from SAP. I researched and found from SAP:

找到了解决方案,我首先使用带有自己的水晶报告的 Visual Studio 2005,然后使用从 SAP 下载的单独水晶报告升级到 VS2010。我从 SAP 研究并发现:

As each version of Crystal Reports has its' own specific runtime which must be correctly deployed, it is critical that the deployed runtime be in agreement with the Crystal Reports assemblies for Visual Studio .NET referenced in your project.

由于每个版本的 Crystal Reports 都有自己特定的运行时,必须正确部署,因此部署的运行时必须与项目中引用的 Visual Studio .NET 的 Crystal Reports 程序集一致。

so i uninstaller pervious version and used only one version and it worked. :) thanks ta.speot.is for your concern. It was never a coding problem.

所以我卸载了以前的版本并且只使用了一个版本并且它有效。:) 感谢 ta.speot.is 的关心。这从来都不是编码问题。

回答by mcsimon

this work for me

这对我有用

  1. Right click the Rpt file.
  2. Choose the properties
  3. Changed

    a. Build Action as "Content"

    b. Copy to Output Directory as "Do not Copy"

    c. Put Empty for Custom Tool and Custom Tool Namespace

  1. 右键单击 Rpt 文件。
  2. 选择属性
  3. 改变了

    一种。将动作构建为“内容”

    湾 复制到输出目录为“不复制”

    C。为自定义工具和自定义工具命名空间置空

回答by TotalMedia

I don't know if this will help someone else or not, but I was having this issue, and it turned out to be such a simple fix for such a dumb move. I had mistyped the filename of the .rpt file...there was a space between two words in the file name (which I normally never do for just this reason) but when I included the name in my code, I had left the space out. corrected the filename, problem went away.

我不知道这是否对其他人有帮助,但我遇到了这个问题,结果证明这是一个如此简单的解决方案,可以解决如此愚蠢的举动。我输错了 .rpt 文件的文件名...文件名中的两个单词之间有一个空格(我通常不会因为这个原因而这样做)但是当我在代码中包含该名称时,我留下了空格出去。更正了文件名,问题就解决了。

回答by serop

Check your path to the .rpt file! The error description has nothing to do with its real reason. It just cannot find your .rpt file!

检查 .rpt 文件的路径!错误描述与其真正原因无关。它只是找不到您的 .rpt 文件!

In my case the path had to be for a .rpt file sitting in Reports subfolder:

在我的情况下,路径必须是位于 Reports 子文件夹中的 .rpt 文件:

Server.MapPath("~/Reports/InvoiceRegular.rpt");

Worked for me.

为我工作。

回答by Krayg

I have found another set of circumstances under which this rather unhelpful error appears.

我发现在另一组情况下会出现这个相当无用的错误。

If you F5 to run/debug your web application in Visual Studio BUT still have the the report open in Crystal Reports (2011), you will get the error.

如果您按 F5 在 Visual Studio 中运行/调试您的 Web 应用程序,但仍然在 Crystal Reports (2011) 中打开报告,您将收到错误消息。

Drove me nuts for about an hour today!

今天让我疯狂了大约一个小时!

回答by Arun CM

Just Do These Steps

只需执行这些步骤

(1) Right click on your ".rpt" file Select "Properties"

(1) 右键单击​​您的“.rpt”文件选择“属性

1.a) Build Action as "Content"

1.a) 将动作构建为“内容

1.b) Copy to Output Directory as "Copy Always"

1.b) 复制到输出目录为“始终复制

(2)Check your path to the .rpt file Server.MapPath("Your path");

(2)检查你的.rpt文件的 路径 Server.MapPath("Your path");

eg: Server.MapPath("~/Reports/MyReport.rpt");

例如: Server.MapPath("~/Reports/MyReport.rpt");

Note: if both rpt and aspx page with report viewer are in same folder then no need to give the full path , you can give only filename.rpt in Server.MapPath .

注意:如果带有报表查看器的 rpt 和 aspx 页面都在同一个文件夹中,则无需提供完整路径,您只能在 Server.MapPath 中提供 filename.rpt 。

回答by JTH

This just happened to me and after hours of headache I found it was a file permissions issue. For some reason when copying from our CR dev server to the shared custom .rpt directory the permissions on the file were all Hymaned up and I had to add permissions for several user groups back to the file.

这只是发生在我身上,经过数小时的头痛,我发现这是一个文件权限问题。出于某种原因,当从我们的 CR 开发服务器复制到共享的自定义 .rpt 目录时,文件的权限都被提升了,我不得不将几个用户组的权限添加回文件。

回答by shams Eldin

copy and paste the folder (aspnet_client) from the (C:\inetpub\wwwroot) to the website folder and make sure that the .rpt file is in the same folder

将文件夹 (aspnet_client) 从 (C:\inetpub\wwwroot) 复制并粘贴到网站文件夹中,并确保 .rpt 文件位于同一文件夹中

回答by Debendra Dash

Please check your .rptfile is present or not.If not please copy from local to hosting folder,it will start work.

请检查您的.rpt文件是否存在。如果不存在,请从本地复制到托管文件夹,它将开始工作。

回答by RAM4

Making sure the file path is correct like @serop mentioned. Also i have noticed where reports folder wouldn't get published. So had to manually publish the report folder.

确保文件路径正确,如提到的@serop。我也注意到报告文件夹不会被发布。所以只好手动发布报表文件夹。