使用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)
qq_遁去的一_1
相关分类