When writing an application that uses HttpClient I have the same approach as this post, in other words I don't use using and instead use a static HttpClient. I have had no problems with that when I want to communicate with only one server. (I set the Ip address as BaseAddress
and proceed)
Now I have the same problem as this question regarding the fact that BaseAddress can not be changed after starting to use the HttpClient.
That question's answers respond with an explanation that it can not be done. You can not change BaseAddress.
So my question (which is different than the linked one so not a duplicate) is what to do if we want to change the ip adress to communicate with other server?
Should we instantiate another HttpClient? (no, we are not going to use using
) How do we correctly proceed from here?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…