这是我第一次在C#中使用Visual Studio (2013)
rdlc报告。当调用方法Render()时,它会抛出一个LocalProcessingException。
代码
Assembly assembly = this.GetType().Assembly;
var stream = assembly.GetManifestResourceStream(assembly.GetName().Name + "." + "Reports.Test.rdlc");
var report = new LocalReport();
report.SetBasePermissionsForSandboxAppDomain(new PermissionSet(PermissionState.Unrestricted));
report.LoadReportDefinition(stream);
var bytes = report.Render("PDF");
var pdf = new MemoryStream(bytes);
我正在使用WebApi开发WebApplication。我需要在流中输入pdf才能将其返回给客户端。
我做错了什么?
编辑:
我认为stream
变量存在问题,因为当我检查它时,我看到ssss.ReadTimeout threw an exception of type System.InvalidOperationException
和ssss.ReadTimeout threw an exception of type System.InvalidOperationException
,但我不知道它是什么意思。
答案 0 :(得分:0)
您需要使用get()
而不是直接调用get()
。
ReportViewer
答案 1 :(得分:0)
我刚刚发现了这个问题。我错过了以下一行:
report.DataSources.Add(new ReportDataSource("MyClass", new List<MyClass>() { new MyClass(){MyProp="2"}}));
添加此行有效!