Visual Studio 2010 的水晶报表错误

发布于 2024-10-05 04:07:50 字数 1033 浏览 3 评论 0原文

我正在尝试从使用 ASP.NET 4.0 和 Visual Studio 2010 构建的 Web 应用程序运行水晶报表。我已从 SAP 站点 (http://www.businessobjects.com/jump/xi/crvs2010/us2_default.asp)

1) SAP Crystal Reports,Visual Studio 版本2010 - 标准 EXE 安装包,将软件安装到 Visual Studio IDE 中。

2) 适用于 .NET Framework 4(64 位)的 SAP Crystal Reports 运行时引擎

我有一个名为 Reports.aspx 的页面,其中有一个水晶报表查看器控件

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

在 Reports.aspx.cs 文件中,我有以下代码

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;
}

: report.Load(path) 行出现以下错误:

不支持的操作。无法在 C++ 堆栈中打开 JRC 引擎处理的文档。

如何解决此问题?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(9

你好,陌生人 2024-10-12 04:07:50

我也遇到了同样的问题,我的问题是报告路径无效,可能你有同样的问题,检查 Server.MapPath("Reports/Sample.rpt") 返回有效路径?

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 ?

大姐,你呐 2024-10-12 04:07:50

确保报告位于 app_code 文件夹中
初始化它的新实例,而不是初始化报告文档并在其中加载报告。

Sample report = new Sample();

这对我有用

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

对不⑦ 2024-10-12 04:07:50

您需要修改 .rpt 文件中的两个属性:

  1. 构建操作默认设置为“嵌入资源”。将其更改为“内容”。
  2. 默认情况下,复制到输出设置为“不复制”。将其更改为“始终复制”。

重建、构建部署包并发布。完毕!

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!

北渚 2024-10-12 04:07:50

注意:下面的术语“网站”指的是 IIS 中的实际网站节点,而不是网站内的虚拟目录。

问题根本原因:应用程序无法访问“aspnet_client”文件夹。
发生这种情况的原因有多种:

  1. 由于 SAP CR 安装程序似乎将 aspnet_client 文件夹安装在 ...\inetpub\wwwroot\ 文件夹中,如果您的网站物理路径不是 ...\inetpub\wwwroot,您的应用程序将不会有权访问 aspnet_client 文件夹。
  2. 如果将 aspnet_client 文件夹移动或删除到网站物理路径的顶层,您的 IIS 应用程序将无法访问该文件夹。

问题解决方案(对于 Windows Server 2008 R2)

  1. 转至服务器上的 IIS 管理器
  2. 展开运行应用程序的网站的树视图节点
  3. 查看紧邻网站节点下方的级别,并确保您看到“aspnet_client”文件夹。
  4. 如果您确实看到了该文件夹,那么这个根本原因可能不是问题的原因。
  5. 如果您没有看到该文件夹​​,请在服务器的硬盘驱动器中搜索该文件夹并将其复制到网站的物理路径。
  6. 在“网站”节点上单击鼠标右键,然后从弹出菜单中单击“刷新”
  7. 您现在应该可以在网站节点正下方的级别看到 aspnet_client 文件夹,并且应用程序中的报告应该可以正常工作。

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.
千秋岁 2024-10-12 04:07:50

当我将网站转换为网络应用程序时,我遇到了这个问题。该报告可以在我的开发机器上正常运行,但不能在服务器上运行。然后我意识到服务器上的 rpt 文件丢失了

默认情况下,报告文件被视为嵌入资源,并且在发布 Web 应用程序时不会复制。我只是单独更改了它们,重新发布了网站,一切又恢复正常了。

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.

柠檬 2024-10-12 04:07:50

如果我错误地在水晶报表设计器中打开报表文件,我也会遇到报表加载失败的情况。

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

無處可尋 2024-10-12 04:07:50

这个错误确实是一种享受,而且似乎有很多可能的前因。幸运的是,我只在我的特定变体上浪费了一天的时间:

ReportDocument.Load() 还制作了本地临时副本。 (这可能仅适用于从网络驱动器位置加载的情况,我没有在本地加载的情况下测试这一点。)

如果发生加载的用户上下文没有创建临时文件的权限在本地,Load 将失败,并出现同样非常无用的错误。


另外,我最终使用进程监视器对此进行了诊断。它可能对您也有帮助。

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.

音盲 2024-10-12 04:07:50

请确保您的报告 rpt 文件位于其原始文件夹中。在我将 MVC 网站“发布”到 IIS 后,我首先遇到了同样的错误。我没有意识到“发布”并没有将rpt文件放入包中。

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.

川水往事 2024-10-12 04:07:50
  1. 将“Crystal 报表引擎”重新安装到服务器

  2. 构建操作设置为“内容”。

它对我来说非常有效......!

  1. Re-install the "Crystal report engine" to the server

  2. Build Action set to "Content".

It perfectly worked for me..!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文