我有一个相当具体的问题,只有当Android设备通过华为P8 Lite创建的wifi热点连接到互联网时才会出现。
当设备通过任何其他方式连接到网络时,不会发生此问题!
每当我尝试使用Header中的Azure AD Bearer Token连接到https端点时,我的请求会在100秒后超时,这是由单声道网络堆栈中的异常引起的:
{System.Threading.Tasks.TaskCanceledException: A task was canceled.
...
at System.Net.Http.HttpClientHandler+<SendAsync>c__async0.MoveNext () [0x004c1] in /Users/builder/data/lanes/4468/f913a78a/source/mono/mcs/class/System.Net.Http/System.Net.Http/HttpClientHandler.cs:391
这是我的代码:
var mAuthContext = new AuthenticationContext("https://login.windows.net/{APP-TENANT}");
var uri = new Uri("https://{APP-URL}/.auth/login/done");
var platformParams = new PlatformParameters(this);
var authResult = await mAuthContext.AcquireTokenAsync("{APP-RESOURCE-ID}", "{APP-CLIENT-ID}", new Uri("https://{APP-URL}/.auth/login/done"), platformParams);
var token = authResult.AccessToken;
using (var _client = new HttpClient())
{
_client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", token);
_client.DefaultRequestHeaders.Add("ZUMO-API-VERSION", "2.0.0");
_client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));
_client.BaseAddress = new Uri(@"https://{APP-URL}");
// Exception is thrown at this point
var result = await _client.GetStringAsync("tables/beleg");
}
任何帮助将不胜感激!