0

i'm trying to send a request to my rabbitmq service in my automated tests, using WebClient object.

code works perfectly on my local machine when running tests in debug mode in visual studio.

when running tests in jenkins, using MSTest, web call returns 404. the reason is that url address includes a "/" char. i tried several options, as replacing this char with %2F and using system encoding. everything tried worked locally and failed miserably on build server

var headerValue = "XXX";
var url = "http://SERVER/api/exchanges/%2F/SOME/OTHER/INFO";
var req = new WebClient();
req.Headers["SOMEHEADER"] = headerValue;
var s = req.DownloadString(url);

looking for information about root cause for that phenomenon or solutions for this to work in jenkins

EDIT: this is not duplication of other questions since, as i mentions, code works perfectly on local machine, and the answers given in the other questions didn't helped solving the problem on remote server. other question

2bis
  • 55
  • 11
  • `code works perfectly on my local machine` - in the IIS Express or the VS? – GSerg Apr 30 '19 at 21:54
  • it is a tests project, so it works locally when run the tests in VS – 2bis May 01 '19 at 14:45
  • Which web server is responding to your `WebClient`? It all comes down to how the web server handles the `//`, not your code. Your code incorrectly sends out a `//` like the duplicate shows (which I still believe to be a valid duplicate). You could verify it by applying the fix and seeing if it now works on your production server. – GSerg May 01 '19 at 14:58
  • rabbitmq server. any way, i worked around it and used EasyNetQ.Management.Client to make to api call. thanks – 2bis May 02 '19 at 08:20

0 Answers0