I have updated my Xamarin.Forms to latest Version (4.5.0.530). After that I cannot change the BaseAddress of my httpclient. I have the following Code:
private static HttpClient client = new HttpClient(new NativeMessageHandler());
client = new HttpClient(new NativeMessageHandler());
client.BaseAddress = new Uri(App.hostserveradress);
client.Timeout = TimeSpan.FromMinutes(5);
Later, after I called the Webservice with:
responseReset = await client.PostAsync("GetResetFotos", contentReset);
I want to change the BaseAddress to another:
client.BaseAddress = new Uri(App.serveradress);
But when I set thew new BaseAddress I get following error:
This instance has already started one or more requests. Properties can only be modified before sending the first request.
Before the updating Xamarin.Forms everything works perfect, now I get the named error.
What can I do?
Thanks.
You don't NEED to set a base address. If you simply use full URLs, you can make requests to as many sites as you want.
This solved my problem thanks @PaulVrugt