Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/33.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net 在Azure云服务上动态设置rdlc文件时出现ReportViewer错误_Asp.net_Azure_Reportviewer - Fatal编程技术网

Asp.net 在Azure云服务上动态设置rdlc文件时出现ReportViewer错误

Asp.net 在Azure云服务上动态设置rdlc文件时出现ReportViewer错误,asp.net,azure,reportviewer,Asp.net,Azure,Reportviewer,好的,这应该很容易,但我不知道发生了什么。 我有一个在Azure云服务中运行的ASP.NET web应用程序,在其中一个aspx页面中有一个ReportViewer。在该页面的代码隐藏处,我动态添加ReportViewer的design.rdlc文件,行为: ReportViewer1.LocalReport.ReportPath = Server.MapPath("reports/myReportFile.rdlc"); 当我在localhost上运行报告时,一切正常,但当我发布到Azure

好的,这应该很容易,但我不知道发生了什么。 我有一个在Azure云服务中运行的ASP.NET web应用程序,在其中一个aspx页面中有一个ReportViewer。在该页面的代码隐藏处,我动态添加ReportViewer的design.rdlc文件,行为:

ReportViewer1.LocalReport.ReportPath = Server.MapPath("reports/myReportFile.rdlc");
当我在localhost上运行报告时,一切正常,但当我发布到Azure云服务时,出现以下错误:

找不到路径的一部分 'F:\sitesroot\0\reports\myReportFile.rdlc'。例外情况详情: System.IO.DirectoryNotFoundException:找不到 路径“F:\sitesroot\0\reports\myReportFile.rdlc”

这应该是显而易见的,对吧?文件路径无效或不存在.rdlc文件。 我尝试在VisualStudio上更改.rdlc文件属性,设置“复制到输出目录”=“始终复制”,再次出现完全相同的错误

意见: 我使用Azure工具/包(.cscfg+.cspkg)发布,并通过Azure管理门户上传它们


关于下一步该做什么有什么想法吗?

经过几个小时的研究,我在这里找到了一个解决方案:

对于rdlc文件,默认情况下,“构建操作”是“嵌入式资源” 导致该文件将嵌入到DLL中。设置“复制到” 将“输出目录”改为“始终复制”会导致Report1.rdlc文件 将被复制到bin文件夹。了解这一点后,有两种选择 要解决这个问题:

  • 将“构建操作”设置为“内容”,然后在LocalReport.ReportPath属性中使用“Report1.rdlc”

  • 将“复制到输出目录”设置为“始终复制”或“更新时复制”,然后在LocalReport.ReportPath属性中使用“bin\Report1.rdlc”

  • 曾文超


    建议#1解决了问题。

    在windows窗体应用程序的报表查看器中找不到rdlc 将“复制到输出目录”设置为“始终复制”或“更新时复制”,然后在LocalReport.ReportPath属性中使用“bin\Report1.rdlc”