Reputation: 649
Our client is failing on one of our stations and is having issues connecting, so I look up the code and I see this:
var request = new HttpRequestMessage(HttpMethod.Post, "rpcapi")
{
Content = new StringContent(json, Encoding.UTF8, "application/json")
};
var options = isFileDownload
? HttpCompletionOption.ResponseHeadersRead
: HttpCompletionOption.ResponseContentRead;
return await _client.SendAsync(request, options, cancellationToken);
Now what confuses me is this line var request = new HttpRequestMessage(HttpMethod.Post, "rpcapi")
because I know the address to our backend is not just "rpcapi", but a rather long address.
So how does this work (mind you the same code is working on other stations)? Does the program somehow know what to switch that "rpcapi" for and if so how and where can I find that code?
Upvotes: 0
Views: 39
Reputation: 11
My best guess is that "rpcapi" is an alias for the rest of your path. Since I didn't know it was possible to alias a path before helping to find an answer for your question, I think your (backend)application knows what your path will be. You most certainly will have a basepath defined somewhere in your application, which might help you find an answer to your question. This should be somewhere in your api project.
This link might help: What's the difference between HttpRequest.Path and HttpRequest.PathBase in ASP.NET Core?
Upvotes: 1