tobania / VSTS.Extension.SqlReportingServices

VSTS Extension for uploading SSRS Reports
MIT License
14 stars 20 forks source link

Getting HTTP 404 on deployment #53

Closed PedroC88 closed 5 years ago

PedroC88 commented 5 years ago
  1. I have a self-hosted agent for VSTS
  2. I can remote to this agent using the same credentials under which the VSTS agent service runs
  3. While logged in I can open a browser and go to http(s)://server/endpoint/ReportService2010.asmx?wsdl
  4. That URL returns an XML
  5. I then copy-paste that URL into the Webservice URL box in VSTS and provide the credentials
  6. The release task fails with the following message: The request failed with HTTP status 404: Not Found.

Not sure what I'm doing wrong to configure the endpoint.

P.S. Before that error I also get the following message (not sure if related) System.Management.Automation.MethodInvocationException: Exception calling "GetFullPath" with "1" argument(s): "Illegal characters in path." ---> System.ArgumentException: Illegal characters in path.

P.S.S. nor the agent nor the reporting server are publicly available on the web, both computers are part of a private network.

ygeelen-tb commented 5 years ago

Pedro,

I think the GetFullPath error is your real issue here. Can you please double check the parameter Remote Resource Path on existence?

And if that doesn't help, doublme check the parameters Local Report Path and Local Resource Path.

Otherwise, please provide screenshots of your full configuration.

Kind regards

PedroC88 commented 5 years ago

TL;DR Switched to the right task, the GetFullPath error doesn't appear anymore but I still get the 404

__ Based on the details that you asked for, I realized I was using the wrong task SQL Server Reports Folder Deployment instead of SQL Server Reports Deployment. I now switched to the correct task which doesn't give me the GetFullPath error but I still get the 404. Here are the variables

  1. Local Report Path: $(System.DefaultWorkingDirectory)/_Build Reports - QA/drop/reports/All Territories/*.rdl
  2. Report Upload Path: General Reports
  3. Web Service URL: http(s)://server-name.domain.com/reportserver/ReportService2010.asmx?wsdl
ygeelen-tb commented 5 years ago

Could you try with Remote Resource Path "/General Reports"?

And try to resolve the URL http://server-name.domain.com/ReportServer?%2fGeneral+Reports&rs:Command=ListChildren

PedroC88 commented 5 years ago
  1. Using /General Reports didn't make any difference
  2. Browing to http://server-name.domain.com/ReportServer?%2fGeneral+Reports&rs:Command=ListChildren lists all reports within the folder
ygeelen-tb commented 5 years ago

https://github.com/tobania/VSTS.Extension.SqlReportingServices/blob/master/SqlReportingServices/SqlReportingServicesDeployment/SqlReportingServicesDeployment.ps1

Could you enable Verbose logging at the bottom of the task and compare the logging output to the Write statements in the script here? That could give an indication how far you're getting and which param could be the problem.

PedroC88 commented 5 years ago

The last message I get before the error is on line 118

Creating WebService proxy using credentials

image

The first error line continues as

The request failed with HTTP status 404: Not Found.

PedroC88 commented 5 years ago

To debug the issue I extracted and simplified the section Creating Webservice proxy. I then ran the script in my computer and in the agent. In my computer it failed with the same 404, in the agent it worked. The 404 is expected in my computer because I don't have access to that SSRS server. Success is also expected from the agent as it has access to the SSRS server. Here's the script I used.

$WsUsername = "user.name";
$wsSecurePass = ConvertTo-SecureString -String "p4ssw0rd" -AsPlainText -Force
$WebserviceUrl = "http(s)://server-name.domain.com/reportserver/ReportService2010.asmx?wsdl"
[System.Management.Automation.PSCredential] $auth = New-Object System.Management.Automation.PSCredential -ArgumentList $WsUsername,$wsSecurePass;
$ssrs = New-WebServiceProxy -Uri $WebserviceUrl -Credential $auth -ErrorAction Stop;

Could it be that somehow the PS script is not running on the agent computer (or perhaps under some different credentials)?

P.S. Your script has a small bug where you declare a variable called $type for the SSRS service, but when you print it for reference is called $dataType which of course is empty.

ygeelen-tb commented 5 years ago

Thanks for checking those things. I would advise to check 2 more things:

PedroC88 commented 5 years ago

OMG... I'm embarrassed I missed something so obvious as the agent (specially after asking the question myself, [facepalm]). That was the issue, it was running under the hosted agent which of course doesn't have access to the reporting server.

I switched it to the proper pool and was able to move forward, some reports appear to be failing but it seems an issue on the definition of the reports so that's on me.

Thank you so much @ygeelen-tb!!

ygeelen-tb commented 5 years ago

@PedroC88 No worries I see people forgetting about that regularly! They should better display the chosen agent in the task title so it's less easy to miss.