本文介绍了报告“的本地报表processing..The定义过程中出现错误”无效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是新来使用SSRS。我使用报告生成一个 .rdlc 文件与2012年VS一个PDF当我试图设置像

I am new to using SSRS. I am using a .rdlc file for report generation in a pdf with VS 2012. When I tried to set the parameters like

ReportParameter param = new ReportParameter(kvp.Key, kvp.Value);
LocalReport.SetParameters(param);

这将引发异常:

的报告的地方报告processing..The定义过程中出现错误无效..无法加载文件或程序'System.Web程序,版本= 4.0.0.0,文化=中性公钥= b03f5f7f11d50a3a'或者一个它的依赖性。访问被拒绝。

{Microsoft.Reporting.WebForms.LocalProcessingException:本地报表处理过程中出错。 ---> Microsoft.Reporting.DefinitionInvalidException:报告'的定义是无效的。 ---> System.IO.FileLoadException:无法加载文件或程序'System.Web程序,版本= 4.0.0.0,文化=中性公钥= b03f5f7f11d50a3a'或它的一个依赖。访问被拒绝。
   在System.Reflection.RuntimeAssembly._nLoad(的AssemblyName文件名,字符串codeBase类,证据assemblySecurity,RuntimeAssembly locationHint,StackCrawlMark&安培; stackMark,IntPtr的pPrivHostBinder,布尔throwOnFileNotFound,布尔forIntrospection,布尔SUP pressSecurityChecks)
   在System.Reflection.RuntimeAssembly.nLoad(的AssemblyName文件名,字符串codeBase类,证据assemblySecurity,RuntimeAssembly locationHint,StackCrawlMark&安培; stackMark,IntPtr的pPrivHostBinder,布尔throwOnFileNotFound,布尔forIntrospection,布尔SUP pressSecurityChecks)
   在System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(的AssemblyName assemblyRef,证据assemblySecurity,RuntimeAssembly reqAssembly,StackCrawlMark&安培; stackMark,IntPtr的pPrivHostBinder,布尔throwOnFileNotFound,布尔forIntrospection,布尔SUP pressSecurityChecks)
   在System.Activator.CreateInstance(字符串assemblyString,字符串的typeName,布尔IGNORECASE,的BindingFlags bindingAttr,粘结剂粘合,对象[] ARGS,CultureInfo的文化,对象[] activati​​onAttributes,证据securityInfo,StackCrawlMark&安培; stackMark)
   在System.Activator.CreateInstance(字符串的AssemblyName,字符串的typeName)
   在System.AppDomain.CreateInstance(字符串的AssemblyName,字符串的typeName)
   在System.AppDomain.CreateInstanceAndUnwrap(字符串的AssemblyName,字符串的typeName)
   在System.AppDomain.CreateAppDomainManager()
   在System.AppDomain.Setup(对象ARG)
   在System.AppDomain.nCreateDomain(字符串的friendlyName,AppDomainSetup设置,证据providedSecurityInfo,证据creatorsSecurityInfo,IntPtr的parentSecurityDescriptor)
   在System.AppDomainManager.CreateDomainHelper(字符串的friendlyName,证据securityInfo,AppDomainSetup appDomainInfo)
   在System.AppDomainManager.CreateDomain(字符串的friendlyName,证据securityInfo,AppDomainSetup appDomainInfo)
   在System.AppDomain.InternalCreateDomain(字符串的friendlyName,证据securityInfo,AppDomainSetup信息)
   在System.AppDomain.CreateDomain(字符串的friendlyName,证据securityInfo,AppDomainSetup信息)
   在Microsoft.Reporting.ReportCompiler.CreateCompilationTempAppDomain()
   在Microsoft.Reporting.ReportCompiler.CompileReport(ICatalogItemContext背景下,字节[] reportDefinition,布尔generateEx pressionHostWithRefusedPermissions,ControlSnapshot&安培;快照)
   ---内部异常堆栈跟踪的结尾---
   在Microsoft.Reporting.ReportCompiler.CompileReport(ICatalogItemContext背景下,字节[] reportDefinition,布尔generateEx pressionHostWithRefusedPermissions,ControlSnapshot&安培;快照)
   在Microsoft.Reporting.LocalService.GetCompiledReport(previewItemContext itemContext,布尔重建,ControlSnapshot&安培;快照)
   在Microsoft.Reporting.LocalService.CompileReport()
   在Microsoft.Reporting.LocalService.Microsoft.Reporting.ILocalProcessingHost.CompileReport()
   在Microsoft.Reporting.WebForms.LocalReport.EnsureExecutionSession()
   ---内部异常堆栈跟踪的结尾---
   在Microsoft.Reporting.WebForms.LocalReport.EnsureExecutionSession()
   在Microsoft.Reporting.WebForms.LocalReport.SetParameters(IEnumerable的
1参数)
   在Microsoft.Reporting.WebForms.Report.SetParameters(ReportParameter参数)`

More details:

{Microsoft.Reporting.WebForms.LocalProcessingException: An error occurred during local report processing. ---> Microsoft.Reporting.DefinitionInvalidException: The definition of the report '' is invalid. ---> System.IO.FileLoadException: Could not load file or assembly 'System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. Access is denied. at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) at System.Activator.CreateInstance(String assemblyString, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityInfo, StackCrawlMark& stackMark) at System.Activator.CreateInstance(String assemblyName, String typeName) at System.AppDomain.CreateInstance(String assemblyName, String typeName) at System.AppDomain.CreateInstanceAndUnwrap(String assemblyName, String typeName) at System.AppDomain.CreateAppDomainManager() at System.AppDomain.Setup(Object arg) at System.AppDomain.nCreateDomain(String friendlyName, AppDomainSetup setup, Evidence providedSecurityInfo, Evidence creatorsSecurityInfo, IntPtr parentSecurityDescriptor) at System.AppDomainManager.CreateDomainHelper(String friendlyName, Evidence securityInfo, AppDomainSetup appDomainInfo) at System.AppDomainManager.CreateDomain(String friendlyName, Evidence securityInfo, AppDomainSetup appDomainInfo) at System.AppDomain.InternalCreateDomain(String friendlyName, Evidence securityInfo, AppDomainSetup info) at System.AppDomain.CreateDomain(String friendlyName, Evidence securityInfo, AppDomainSetup info) at Microsoft.Reporting.ReportCompiler.CreateCompilationTempAppDomain() at Microsoft.Reporting.ReportCompiler.CompileReport(ICatalogItemContext context, Byte[] reportDefinition, Boolean generateExpressionHostWithRefusedPermissions, ControlSnapshot& snapshot) --- End of inner exception stack trace --- at Microsoft.Reporting.ReportCompiler.CompileReport(ICatalogItemContext context, Byte[] reportDefinition, Boolean generateExpressionHostWithRefusedPermissions, ControlSnapshot& snapshot) at Microsoft.Reporting.LocalService.GetCompiledReport(PreviewItemContext itemContext, Boolean rebuild, ControlSnapshot& snapshot) at Microsoft.Reporting.LocalService.CompileReport() at Microsoft.Reporting.LocalService.Microsoft.Reporting.ILocalProcessingHost.CompileReport() at Microsoft.Reporting.WebForms.LocalReport.EnsureExecutionSession() --- End of inner exception stack trace --- at Microsoft.Reporting.WebForms.LocalReport.EnsureExecutionSession() at Microsoft.Reporting.WebForms.LocalReport.SetParameters(IEnumerable1 parameters) at Microsoft.Reporting.WebForms.Report.SetParameters(ReportParameter parameter)`

我在想什么。在一些帖子,它的被建议使用缺 Microsoft.ReportViewer.PorcessingObjectMode.dll 。我这样做,所以我拥有所有必需的DLL像 - Microsoft.ReportViewer.Common.dll
- Microsoft.ReportViewer.WebForms.dll
- Microsoft.ReportViewer.ProcessingObjectModel.dll
是否有

What am I missing. In some posts,it 's been advised to use missing Microsoft.ReportViewer.PorcessingObjectMode.dll . I did that so I have all the required dlls like - Microsoft.ReportViewer.Common.dll- Microsoft.ReportViewer.WebForms.dll- Microsoft.ReportViewer.ProcessingObjectModel.dll are there.

我提到这个帖子。但我仍不能完成这件事。你的帮助是非常AP preciated!

I referred to this post. But still I could not get this done. Your help is much appreciated !

推荐答案

编辑:解决方案似乎是,该报告确定指标没有被加载。它可以通过例如

Solution seem to be that the report defintion was not loaded. It can be done for example by

var reportStream = System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("ReportName.rdlc");
localReport.LoadReportDefinition(reportStream);


老的建议 - 这里不适用:


Old suggestion - not applicable here:

老实说,可能有不同的东西。
首先,设置参数是特殊的。如果你的项目.NET 4或更高版本运行报表引擎比将您的应用程序不同的应用程序域中运行。所以,你必须设置该参数可以用来权限。否则拒绝所有参数。

Honestly, there might be different things.First of all, setting parameters is special. If your projects runs in .NET 4 or higher the reporting engine will run within a different app domain than your application. So you have to set permissions that the parameters can be used. Otherwise it rejects all parameter.

var report = new LocalReport();
report.SetBasePermissionsForSandboxAppDomain(new PermissionSet(PermissionState.Unrestricted));

另一个问题可能是您正在使用您的开发机器上的不同的ReportViewer版本比部署的机器上。

Another issue could be that you are using a different ReportViewer version on your development machine than on the deployment machine.

这篇关于报告“的本地报表processing..The定义过程中出现错误”无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-15 11:58