views:

210

answers:

1

Hi everyone,

I'm trying to generate a report directly from the code (to send it by mail after). I make this in a windows service.

So here is what I'm doing:

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)

When debugging this code, I can see it throws a MissingEndpointException where I make the SetParameters(paramList) with this message:

The attempt to connect to the report server failed. Check your connection information and that the report server is a compatible version.

Looking in the server's log file, I can see this:

ui!ReportManager_0-8!878!06/02/2010-11:34:36:: Unhandled exception: System.Web.HttpException: The file '/Reports_client/ReportExecution2005.asmx' does not exist. at System.Web.UI.Util.CheckVirtualFileExists(VirtualPath virtualPath) at System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile) at System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile) at System.Web.Compilation.BuildManager.GetVPathBuildResult(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile) at System.Web.Compilation.BuildManager.GetVPathBuildResult(HttpContext context, VirtualPath virtualPath)
at System.Web.UI.WebServiceParser.GetCompiledType(String inputFile, HttpContext context) at System.Web.Services.Protocols.WebServiceHandlerFactory.GetHandler(HttpContext context, String verb, String url, String filePath) at System.Web.HttpApplication.MapHttpHandler(HttpContext context, String requestType, VirtualPath path, String pathTranslated, Boolean useAppConfig) at System.Web.HttpApplication.MapHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

I didn't find any resource on the web that fits my problem. Does anyone have a clue ? I'm able to view the reports from a web application, so I'm sure the server is running.

Thanks in advance.

A: 

Nevermind, I was confused with servers names...

Instead of using

http://server/Reports_client

, I just needed to use

http://server/ReportServer_client

Shimrod