C# 无法在Windows Server 2012中将报表呈现为PDF格式

C# 无法在Windows Server 2012中将报表呈现为PDF格式,c#,wpf,winforms,pdf,rdlc,C#,Wpf,Winforms,Pdf,Rdlc,我正面临.NET中最奇怪的技术问题之一。我编写了以下逻辑来将报表导出到PDF,它在所有系统中工作,除了WindowsServer2012。有什么问题吗?我尝试使用最新的Microsoft.ReportViewer.Winforms.dll,但也没用。如果有人有什么想法,请帮助我 reportViewer = new ReportViewer(); Warning[] warnings; string[] streamids;

我正面临
.NET
中最奇怪的技术问题之一。我编写了以下逻辑来将报表导出到
PDF
,它在所有
系统
中工作,除了
WindowsServer2012
。有什么问题吗?我尝试使用最新的
Microsoft.ReportViewer.Winforms.dll
,但也没用。如果有人有什么想法,请帮助我

reportViewer = new ReportViewer();
            Warning[] warnings;
            string[] streamids;
            string mimeType, encoding, filenameExtension;
            Assembly assembly = Assembly.LoadFrom(report.AssemblyName);
            Stream stream = assembly.GetManifestResourceStream(report.ReportName);
            reportViewer.LocalReport.LoadReportDefinition(stream);                
            //reportViewer.LocalReport.DataSources.Clear();
            //reportViewer.ProcessingMode = ProcessingMode.Local;
            //lr = reportViewer.LocalReport;
            //lr.ReportPath = "Reports\\CommentReport.rdlc";
            reportViewer.LocalReport.DataSources.Clear();                
            foreach (var dataSource in report.DataSources)
            {
                reportViewer.LocalReport.DataSources.Add(new ReportDataSource(dataSource.Key, dataSource.Value));
            }

            pdfByteArray = reportViewer.LocalReport.Render("PDF", null, out mimeType, out encoding, out filenameExtension, out streamids, out warnings);

尝试将所有相关引用属性特定的版本设置为True。但没用,你犯了什么错?我相信这可以很好地解决您的问题: