Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

rs.exe report scripting - Can't connect to server ReportService2005.asmx

I am calling this rs.exe script to run and export the report:

rs -i RunReport.rss -s http://localhost/reportserver -u myUsername -p myPassword -e Exec2005

The error I get is:

Could not connect to server: http://localhost/reportserver/ReportService2005.asmx

Currently all of our reports are set up to use 'Credentials supplied by the user'. If I go to the report and input the username and password, it runs just fine. It just doesn't work running the script.

When I change the report's datasource to use Windows Integrated Security, the script works.

Any ideas on how what I'm doing wrong? Or alternatively, is there a way to change the report's permissions to Windows Auth and then change it back?

SSRS 2012

My rss script is

Public Sub Main()
  rs.Credentials = System.Net.CredentialCache.DefaultCredentials

  Dim format as string = "EXCEL"
  Dim fileName as String = "C:\test.xls"
  Dim reportPath as String = "/MyDirectory/Report1"

  ' Prepare Render arguments
  Dim historyID as string = Nothing
  Dim deviceInfo as string = Nothing
  Dim extension as string = Nothing
  Dim encoding as string 
  Dim mimeType as string 
  Dim warnings() AS Warning = Nothing
  Dim streamIDs() as string = Nothing
  Dim results() as Byte

  rs.LoadReport(reportPath, historyID)

  results = rs.Render(format,  deviceInfo, extension, _
   mimeType, encoding,  warnings, streamIDs)

  ' Open a file stream and write out the report
  Dim stream  As FileStream = File.OpenWrite(fileName)
  stream.Write(results, 0, results.Length)
  stream.Close()
End Sub
like image 484
Gabe Avatar asked Nov 08 '12 22:11

Gabe


2 Answers

I had the same error, it was due to a mistake in the configuration: the script was set to run against the Report Manager URL and not the Web Service URL (both can be found in the Reporting Services Configuration Manager). Switching to the Web Service URL solved it for me.

(I reckon you've found a workaround in the last 3 years, but I'll put this here if someone else is struggling with the same problem)

like image 150
Soundislate Avatar answered Nov 15 '22 10:11

Soundislate


Came across the same issue. Addressed it by changing the Reporting Service Configuration Manager database credentials from Integrated Security to SQL server admin account.

like image 24
Pam Avatar answered Nov 15 '22 09:11

Pam