" HttpClientHandler:Dispose(bool)'无法从方法中获取 `System.Net.ServicePointManager:CloseConnectionGroup(string)"
发送请求时会发生此错误,如何解决?
using (var client = new HttpClient())
{
client.BaseAddress = new Uri(urlTemplate);
client.Timeout = new TimeSpan(0, 0, 30);
var connectionString = string.Format(UrlTemplate, method.ToString().ToLower(), CreateParametrsString(parametrs));
var response = await client.GetAsync(connectionString);
if (response.StatusCode != HttpStatusCode.OK)
{
using (StreamReader reader = new StreamReader((await response.Content.ReadAsStreamAsync()), Encoding.GetEncoding("windows-1252")))
{
content = reader.ReadToEnd();
var json = content;
var ass = JsonConvert.DeserializeObject<T>(json);
if (ass != null)
Debug.WriteLine(String.Format("=>GETTED [{0}] table.", typename));
else
LoggingService.Report(null, new Dictionary<string, string> {
{ "request",typename },
{ "content",content },
});
return ass;
}
}
}
答案 0 :(得分:0)
您最有可能遇到单声道框架中的错误。我相信它是
https://bugzilla.xamarin.com/show_bug.cgi?id=41133
有两个解决此问题的拉取请求:
https://github.com/mono/mono/pull/4277(掌握修复)
https://github.com/mono/mono/pull/4278(Cycle9修复单声道4.8)
包含此修复程序的当前Mono版本是:
https://github.com/mono/mono/releases/tag/mono-4.8.0.478
因此,您需要一个包含此版本或更高版本的版本。
https://github.com/mono/mono/commits/084f91256b05249f5f35973019561e6fefbdc053/mono/utils/mono-sha1.c
因此,这应该包含在当前的Beta
频道版本中:
https://releases.xamarin.com/beta-release-cycle-9-rc-refresh-builds3/