【发布时间】:2010-06-02 10:12:12
【问题描述】:
我正在尝试直接从代码生成报告(之后通过邮件发送)。我是在 Windows 服务中制作的。
这就是我正在做的事情:
Dim rview As New ReportViewer()
Dim reportServerAddress As String = "http://server/Reports_client"
rview.ServerReport.ReportServerUrl = New Uri(reportServerAddress)
Dim paramList As New List(Of Microsoft.Reporting.WinForms.ReportParameter)
paramList.Add(New Microsoft.Reporting.WinForms.ReportParameter("param1", t.Value))
paramList.Add(New Microsoft.Reporting.WinForms.ReportParameter("CurrentDate", Date.Now))
Dim reportsDirectory As String = "AppName.Reports"
Dim reportPath As String = String.Format("/{0}/{1}", reportsDirectory, reportName)
rview.ServerReport.ReportPath = reportPath
rview.ServerReport.SetParameters(paramList) 'This is where I get the exception
Dim mimeType, encoding, extension, deviceInfo As String
Dim streamids As String()
Dim warnings As Microsoft.Reporting.WinForms.Warning()
deviceInfo = "<DeviceInfo><SimplePageHeaders>True</SimplePageHeaders></DeviceInfo>"
Dim format As String = "PDF"
Dim bytes As Byte() = rview.ServerReport.Render(format, deviceInfo, mimeType, encoding, extension, streamids, warnings)
在调试这段代码时,我可以看到它抛出了一个 MissingEndpointException,我用这条消息创建了 SetParameters(paramList):
连接到报告的尝试 服务器失败。检查您的连接 信息和报告服务器 是兼容版本。
查看服务器的日志文件,我可以看到:
ui!ReportManager_0-8!878!06/02/2010-11:34:36:: 未处理的异常: System.Web.HttpException:文件 '/Reports_client/ReportExecution2005.asmx' 不存在。在 System.Web.UI.Util.CheckVirtualFileExists(虚拟路径 虚拟路径)在 System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(虚拟路径 virtualPath,布尔值 noBuild,布尔值 allowCrossApp,布尔值 allowBuildInPrecompile) 在 System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext 上下文,VirtualPath virtualPath, 布尔 noBuild,布尔 allowCrossApp,布尔值 allowBuildInPrecompile) 在 System.Web.Compilation.BuildManager.GetVPathBuildResult(HttpContext 上下文,VirtualPath virtualPath, 布尔 noBuild,布尔 allowCrossApp,布尔值 allowBuildInPrecompile) 在 System.Web.Compilation.BuildManager.GetVPathBuildResult(HttpContext 上下文,VirtualPath virtualPath)
在 System.Web.UI.WebServiceParser.GetCompiledType(字符串 inputFile,HttpContext 上下文)在 System.Web.Services.Protocols.WebServiceHandlerFactory.GetHandler(HttpContext 上下文,字符串动词,字符串 url, 字符串文件路径)在 System.Web.HttpApplication.MapHttpHandler(HttpContext 上下文,字符串请求类型, VirtualPath 路径,字符串 pathTranslated, Boolean useAppConfig) 在 System.Web.HttpApplication.MapHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() 在 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean & completedSynchronously)
我没有在网络上找到任何适合我的问题的资源。有人有线索吗 ?我可以从 Web 应用程序查看报告,所以我确定服务器正在运行。
提前致谢。
【问题讨论】:
标签: reporting-services ssrs-2008