使用HttpClient的C#代碼如下:public class TestClass{ private static readonly HttpClient _httpClient = new HttpClient(); public async Task TestMethod () {
//...
_httpClient.BaseAddress = new Uri("http://xxx"); //...
}
}運(yùn)行時(shí)報(bào)錯(cuò)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)
- 1 回答
- 0 關(guān)注
- 2024 瀏覽
添加回答
舉報(bào)
0/150
提交
取消