MVC 5 应用程序 RDLC 报告在托管后抛出异常,但与 visual studio 一起工作正常
MVC 5 application RDLC Report throws an exception after hosting but works fine with visual studio
这里是异常和内部异常消息以及堆栈跟踪。当我 运行 和 visual studio 时,这真的很好用。我使用 ReportViewerForMvc 并通过 Nuget 安装。所以我确实引用了所有 .dll。唯一的问题是一旦我使用 unoeuro 托管它就无法正常工作。
Exception of type 'System.Web.HttpUnhandledException' was thrown.
at System.Web.UI.Page.HandleError(Exception e) at
System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest() at
System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context)
at System.Web.UI.Page.ProcessRequest(HttpContext context) at
ASP.reportviewerwebform_aspx.ProcessRequest(HttpContext context) at
System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step,
Boolean& completedSynchronously)
An error occurred during local report processing.
at
Microsoft.Reporting.WebForms.LocalReport.EnsureExecutionSession()
at Microsoft.Reporting.WebForms.LocalReport.GetParameters() at
ReportViewerForMvc.ReportViewerExtensions.SetProperties(LocalReport
localReport, LocalReport properties) at
ReportViewerForMvc.ReportViewerExtensions.SetProperties(ReportViewer
reportViewer, ReportViewer properties) at
ReportViewerForMvc.ReportViewerWebForm.BuildReportViewer() at
ReportViewerForMvc.ReportViewerWebForm.Page_Load(Object sender,
EventArgs e) at
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender,
EventArgs e) at System.Web.UI.Control.OnLoad(EventArgs e) at
System.Web.UI.Control.LoadRecursive() at
System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
请帮我解决这个问题。我已经经历了很多线程,但找不到解决方案
虽然不知道是什么原因,但我可以猜到它可能是什么。 RDLC 报告文件(例如 MyReport.rdlc
)可能未正确部署到目标环境,或者当执行目录更改时未驻留在预期的文件夹(相对路径)中。
在 Visual Studio 中,确保 Copy to Output Directory
属性 设置为 Copy if newer/always
,并且在 IIS 上执行时,文件可能出现在 \bin
目录中,而在本地,它们可能在 bin\Debug
.
内
当传入 MyReport.rdlc
的文件名时,在我们的应用程序中,我们将其设置为可配置并构建如下路径:
var rdlcFullPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, ConfigurationManager.AppSettings["ReportingPath"], "MyReport.rdlc");
在web.config
文件中,添加路径设置:
<add key="ReportingPath" value="bin\Reports" />
您可以覆盖每个环境的设置以匹配目标结构。
这里是异常和内部异常消息以及堆栈跟踪。当我 运行 和 visual studio 时,这真的很好用。我使用 ReportViewerForMvc 并通过 Nuget 安装。所以我确实引用了所有 .dll。唯一的问题是一旦我使用 unoeuro 托管它就无法正常工作。
Exception of type 'System.Web.HttpUnhandledException' was thrown.
at System.Web.UI.Page.HandleError(Exception e) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest() at System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context)
at System.Web.UI.Page.ProcessRequest(HttpContext context) at ASP.reportviewerwebform_aspx.ProcessRequest(HttpContext context) at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) An error occurred during local report processing.at Microsoft.Reporting.WebForms.LocalReport.EnsureExecutionSession()
at Microsoft.Reporting.WebForms.LocalReport.GetParameters() at ReportViewerForMvc.ReportViewerExtensions.SetProperties(LocalReport localReport, LocalReport properties) at ReportViewerForMvc.ReportViewerExtensions.SetProperties(ReportViewer reportViewer, ReportViewer properties) at ReportViewerForMvc.ReportViewerWebForm.BuildReportViewer() at ReportViewerForMvc.ReportViewerWebForm.Page_Load(Object sender, EventArgs e) at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) at System.Web.UI.Control.OnLoad(EventArgs e) at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
请帮我解决这个问题。我已经经历了很多线程,但找不到解决方案
虽然不知道是什么原因,但我可以猜到它可能是什么。 RDLC 报告文件(例如 MyReport.rdlc
)可能未正确部署到目标环境,或者当执行目录更改时未驻留在预期的文件夹(相对路径)中。
在 Visual Studio 中,确保 Copy to Output Directory
属性 设置为 Copy if newer/always
,并且在 IIS 上执行时,文件可能出现在 \bin
目录中,而在本地,它们可能在 bin\Debug
.
当传入 MyReport.rdlc
的文件名时,在我们的应用程序中,我们将其设置为可配置并构建如下路径:
var rdlcFullPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, ConfigurationManager.AppSettings["ReportingPath"], "MyReport.rdlc");
在web.config
文件中,添加路径设置:
<add key="ReportingPath" value="bin\Reports" />
您可以覆盖每个环境的设置以匹配目标结构。