ошибка средства просмотра отчетов 14: не удалось загрузить узел узла выражения - PullRequest
0 голосов
/ 02 сентября 2018

У меня есть простой .rdlc файл, в котором определен параметр. Когда я заполняю (отправляю) значение параметра, я получаю сообщение об ошибке:

Failed to load expression host assembly. 
Details: Type 'System.Web.HttpContextWrapper' 
in assembly 'System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
is not marked as serializable.

однако, удаляя значение параметра, отчет без проблем выводится.

ReportViewer1.LocalReport.DataSources.Clear();
ReportViewer1.LocalReport.ReportPath = Server.MapPath("~/Report/report1.rdlc");

//If following line commented, there is no problem, 
//and report is rendered correctly.
ReportViewer1.LocalReport.SetParameters(new ReportParameter("test1", "some value"));

ReportViewer1.LocalReport.DataSources.Add(new ReportDataSource("DataSet1", Data));
ReportViewer1.DataBind();

target .net framework: 4.5.2, проект - веб-форма asp.net (веб-приложение), Microsoft.ReportingServices.ReportViewerControl.WebForms версия 140.1000.523 добавлена ​​nuget.

обновление

Я добавил System.Web как ссылку на файл rdlc, и теперь получаю полную ошибку:

[SerializationException: Type 'System.Web.HttpContextWrapper' in assembly 'System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' is not marked as serializable.]
   System.AppDomain.CreateInstanceFromAndUnwrap(String assemblyName, String typeName) +0
   Microsoft.ReportingServices.Diagnostics.AssemblyLocationResolver.CreateResolver(AppDomain tempAppDomain) +98
   Microsoft.ReportingServices.RdlExpressions.ExprHostCompiler.ResolveAssemblylocations(List`1 codeModules, CompilerParameters options, ErrorContext errorContext, AppDomain compilationTempAppDomain) +35
   Microsoft.ReportingServices.RdlExpressions.ExprHostCompiler.InternalCompile(AppDomain compilationTempAppDomain, Boolean refusePermissions) +377
   Microsoft.ReportingServices.RdlExpressions.<>c__DisplayClass2.<Compile>b__0() +19
   Microsoft.ReportingServices.Diagnostics.<>c__DisplayClass1.<Run>b__0(Object state) +116
   System.Security.SecurityContext.Run(SecurityContext securityContext, ContextCallback callback, Object state) +13049529
   Microsoft.ReportingServices.Diagnostics.RevertImpersonationContext.Run(ContextBody callback) +99
   Microsoft.ReportingServices.RdlExpressions.ExprHostCompiler.Compile(IExpressionHostAssemblyHolder expressionHostAssemblyHolder, AppDomain compilationTempAppDomain, Boolean refusePermissions, PublishingVersioning versioning) +184
   Microsoft.ReportingServices.ReportPublishing.ReportPublishing.Phase3(ParameterInfoCollection& parameters, Dictionary`2& groupingExprCountAtScope) +1445
   Microsoft.ReportingServices.ReportPublishing.ReportPublishing.InternalCreateIntermediateFormat(Stream definitionStream, String& description, String& language, ParameterInfoCollection& parameters, DataSourceInfoCollection& dataSources, DataSetInfoCollection& sharedDataSetReferences, UserLocationFlags& userReferenceLocation, ArrayList& dataSetsName, Boolean& hasExternalImages, Boolean& hasHyperlinks, Byte[]& dataSetsHash) +125
   Microsoft.ReportingServices.ReportPublishing.ReportPublishing.CreateIntermediateFormat(Byte[] definition, String& description, String& language, ParameterInfoCollection& parameters, DataSourceInfoCollection& dataSources, DataSetInfoCollection& sharedDataSetReferences, UserLocationFlags& userReferenceLocation, ArrayList& dataSetsName, Boolean& hasExternalImages, Boolean& hasHyperlinks, Byte[]& dataSetsHash) +82
   Microsoft.ReportingServices.ReportProcessing.ReportProcessing.CompileOdpReport(PublishingContext reportPublishingContext, PublishingErrorContext errorContext, String& reportDescription, String& reportLanguage, ParameterInfoCollection& parameters, DataSourceInfoCollection& dataSources, DataSetInfoCollection& sharedDataSetReferences, UserLocationFlags& userReferenceLocation, ArrayList& dataSetsName, Boolean& hasExternalImages, Boolean& hasHyperlinks, Byte[]& dataSetsHash) +122
   Microsoft.ReportingServices.ReportProcessing.ReportProcessing.CreateIntermediateFormat(PublishingContext reportPublishingContext) +192

[ReportProcessingException: An unexpected error occurred in Report Processing.]
   Microsoft.ReportingServices.ReportProcessing.ReportProcessing.CreateIntermediateFormat(PublishingContext reportPublishingContext) +1006
   Microsoft.Reporting.ReportCompiler.CompileReport(ICatalogItemContext context, Byte[] reportDefinition, Boolean generateExpressionHostWithRefusedPermissions, ControlSnapshot& snapshot) +195

[DefinitionInvalidException: The definition of the report 'F:\*****************\report1.rdlc' is invalid.]
   Microsoft.Reporting.ReportCompiler.CompileReport(ICatalogItemContext context, Byte[] reportDefinition, Boolean generateExpressionHostWithRefusedPermissions, ControlSnapshot& snapshot) +261
   Microsoft.Reporting.LocalService.GetCompiledReport(PreviewItemContext itemContext, Boolean rebuild, ControlSnapshot& snapshot) +228
   Microsoft.Reporting.LocalService.CompileReport() +29
   Microsoft.Reporting.LocalService.Microsoft.Reporting.ILocalProcessingHost.CompileReport() +5
   Microsoft.Reporting.WebForms.LocalReport.EnsureExecutionSession() +61

[LocalProcessingException: An error occurred during local report processing.]
   Microsoft.Reporting.WebForms.LocalReport.EnsureExecutionSession() +149
   Microsoft.Reporting.WebForms.LocalReport.SetParameters(IEnumerable`1 parameters) +57
   Microsoft.Reporting.WebForms.Report.SetParameters(ReportParameter parameter) +48
   ***********.btnPrint_Click(Object sender, EventArgs e) in F:\************.cs:199
   System.Web.UI.WebControls.Button.OnClick(EventArgs e) +9782450
   System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +204
   System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +12
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +15
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +35
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1639
...