开发环境 :VS2008 ,Crystal Report 2008
开发的网站没有使用系统默认的wwwroot目录,而是另建了一个目录 D:/published 做为网站的目录。
用Crystal Report2008在VS2008中开发报表,显示 正常,但当发布到网站上时水晶报表页没有图片,显示如下图,但是工作正常。
![]()
于是找原因,分析网页源码,找到代码如下:
<td nowrap width=8> </td><td nowrap width=22px><input type="image" name="CrystalReportViewer1$ctl02$ctl00" disabled="disabled" title="Export" src="/aspnet_client/system_web/2_0_50727/CrystalReportWebFormViewer4/images/toolbar/export.gif" onmouseover="this.src='/aspnet_client/system_web/2_0_50727/CrystalReportWebFormViewer4/images/toolbar/export_over.gif'" onmouseout="this.src='/aspnet_client/system_web/2_0_50727/CrystalReportWebFormViewer4/images/toolbar/export.gif'" style="height:22px;width:22px;border-width:0px;" /></td>
<td nowrap width=8> </td><td nowrap width=22px><input type="image" name="CrystalReportViewer1$ctl02$ctl01" disabled="disabled" title="Print" src="/aspnet_client/system_web/2_0_50727/CrystalReportWebFormViewer4/images/toolbar/print.gif" onmouseover="this.src='/aspnet_client/system_web/2_0_50727/CrystalReportWebFormViewer4/images/toolbar/print_over.gif'" onmouseout="this.src='/aspnet_client/system_web/2_0_50727/CrystalReportWebFormViewer4/images/toolbar/print.gif'" style="height:22px;width:22px;border-width:0px;" /></td>
<td nowrap width=8> </td><td nowrap width=22px><input type="image" name="CrystalReportViewer1$ctl02$ctl03" disabled="disabled" title="Show/Hide Group Tree" src="/aspnet_client/system_web/2_0_50727/CrystalReportWebFormViewer4/images/toolbar/grouptree.gif" onmouseover="this.src='/aspnet_client/system_web/2_0_50727/CrystalReportWebFormViewer4/images/toolbar/grouptree_over.gif'" onmouseout="this.src='/aspnet_client/system_web/2_0_50727/CrystalReportWebFormViewer4/images/toolbar/grouptree.gif'" style="height:22px;width:22px;border-width:0px;" /></td>
根据源码,估计是因为网站没有找到图片资源所致,于是回到网站发布 目录,发现目录下的确并没有"/aspnet_client/system_web/2_0_50727/CrystalReportWebFormViewer4/images/toolbar/export.gif”等等资源
网上有一说:IIS下没有此类资源的原因是: 没有安装 Crystal Report Web Service,或者没有在IIS中注册。
针对此类情况,通常的解决办法 是:
IIS默认的网站,而我的发布目录中没有此文件夹,于是先到C:/inetpub/wwwroot中找,结果找到C:/inetpub/wwwroot/aspnet_client/system_web/2_0_50727/CrystalReportWebFormViewer4
代码
注册:首先进入MSDOS方式(可通过“开始”-“运行...”,键入cmd,回车)。
将 C:/WINDOWS/Microsoft.NET/Framework/v1.0.3705 作为当前目录,其中 C:/WINDOWS 根据操作系统的安装位置决定,v1.0.3705 根据安装的 .NET FRAMEWORK 的版本决定。
键入 aspnet_regiis -i。
最后,在 IIS 中会出现一个 CrystalReportWebFormViewer Web 共享目录。
针对我的情况,联想到我没有使用
正是我想要的,直接 拷到我的VS2008开发项目中,

重新编译、发布,于是在我 的发布 目录中出现了缺失的目录资源。重新运行网站,出现了相关图片
![]()
本文介绍了一种解决VS2008环境下水晶报表发布后图片资源丢失的问题,通过拷贝必要的资源文件到发布目录并重新编译发布,成功解决了水晶报表页面图片不显示的问题。


被折叠的 条评论
为什么被折叠?



