使用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)
添加回答
举报
0/150
提交
取消