1、检查是否安装了 ReportViewer 插件,一般在新系统上就会忘了安装这个插件,把项目拷贝过来后就出现这些鬼问题,
2、 设置c:windows\temp 目录访问权限 temp--> 属性-->安全-- > 添加network service -->并赋予其权限为 读 和 写--> 确定
3、 设置c:windows\temp 目录访问权限 temp--> 属性-->安全-- > 添加IIS_IUSRS -->并赋予其权限为 读 和 写--> 确定
4、 设置发布网站的程序目录中bin文件夹的权限 同样添加 network service 并设置权限为读取、 运行
5、检查数据源是不是匹配,或许就差一个字符就弄死你,
7、对应参数是否对应一致,很多时候参数不一致也这样子提示,
这些问题都是常的问题,但是系统就只报 “本地报表处理期间出错” ,一般拒绝访问什么什么文件的 就是上面的权限没给的问题。
8. 2.拷贝三个dll到Bin内:
Microsoft.ReportViewer.Common.dll
Microsoft.ReportViewer.WebForms.dll
Microsoft.ReportViewer.ProcessingObjectModel.dll
其中,第一个和第二个可以在项目中直接添加引用,引用后右键属性,将“复制到本地”设置成true,这样就添加到了项目中。第三个有些复杂,它需要运行在GAC中,不能像其他两个一样直接操作。微软也意识到了这一点,就专门制作了一个安装包,安装后直接把第三个安装到了GAC中。因为我的版本是vs2010,所以提供2010版的下载链接:点击这里 。其他版本的下载地址可以该页面的下方的“相关资源”链接中找到。
至此,应该可以解决99%的问题,但是我在寻找答案的过程中发现该方法可解决不了。
提供2010版的下载链接(ReportViewer)
https://www.microsoft.com/en-us/download/confirmation.aspx?id=6442
问题二:System.UnauthorizedAccessException: 对路径“D:\RDIMS\TCPortal\rdlc\ORC\4396.jpeg”的访问被拒绝
引发类型为“System.Web.HttpUnhandledException”的异常。
System.Web.HttpUnhandledException (0x80004005): 引发类型为“System.Web.HttpUnhandledException”的异常。 ---> System.UnauthorizedAccessException: 对路径“D:\RDIMS\TCPortal\rdlc\ORC\4396.jpeg”的访问被拒绝。 在 System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) 在 System.IO.File.InternalDelete(String path, Boolean checkHost) 在 TCPortal_Print_RnQRCodeEncoder.SavePicture(Byte[] picBytes, String picNum, String path) 在 TCPortal_Print_RnQRCodeEncoder.ImgCodePath(Int32 size, String path) 在 TCPortal_Print_RnQRCodeEncoder.Print() 在 TCPortal_Print_RnQRCodeEncoder.Page_Load(Object sender, EventArgs e) 在 System.Web.UI.Control.OnLoad(EventArgs e) 在 System.Web.UI.Control.LoadRecursive() 在 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) 在 System.Web.UI.Page.HandleError(Exception e) 在 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) 在 System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) 在 System.Web.UI.Page.ProcessRequest() 在 System.Web.UI.Page.ProcessRequest(HttpContext context) 在 ASP.tcportal_print_rnprint_aspx.ProcessRequest(HttpContext context) 在 System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() 在 System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step) 在 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
解决 给目的文件夹读写的Network Service权限:在需要进行读写操作的目录下添加Network Service这个帐号。
具体过程:对该文件夹按右键--属性--安全--添加--高级--立即查找--在“搜索结果”下选“NETWORK SERVICE”--确定--确定--确定