使用HttpClient的C#代码如下:
public class TestClass
{
private static readonly HttpClient _httpClient = new HttpClient();
public async Task TestMethod ()
{
//...
_httpClient.BaseAddress = new Uri("http://xxx");
//...
}
}
运行时报错
System.InvalidOperationException: This instance has already started one or more requests. Properties can only be modified before sending the first request.
at System.Net.Http.HttpClient.CheckDisposedOrStarted()
at System.Net.Http.HttpClient.set_BaseAddress(Uri value)
慕雪6442864
慕的地6264312
小怪兽爱吃肉
相关分类