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

4
  • code works perfectly on my local machine - in the IIS Express or the VS? Commented Apr 30, 2019 at 21:54
  • it is a tests project, so it works locally when run the tests in VS Commented May 1, 2019 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. Commented May 1, 2019 at 14:58
  • rabbitmq server. any way, i worked around it and used EasyNetQ.Management.Client to make to api call. thanks Commented May 2, 2019 at 8:20

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.