实现:
try {
//post-anfrage an webservice starten
var request = await httpClient.PostAsync(SettingsPage.WebServiceURL + site,
content);
if (!request.IsSuccessStatusCode) {
if (request.StatusCode == System.Net.HttpStatusCode.Unauthorized) {
await User.Instance.Logout();
}
var message = await request.Content.ReadAsStringAsync();
RaiseErrorMessage(null, message);
}
SaveCookies(request);
timer.Change(PING_INTERVAL, PING_INTERVAL);
return request;
}
catch (TaskCanceledException e) {
RaiseConnectionError(null, "Verbindung zu Webservice fehlgeschlagen!");
return null;
}
catch (Exception ex) {
RaiseConnectionError(null, "Es ist etwas schief gelaufen..." + System.Environment.NewLine + "Bitte Support Kontaktieren!");
Debug.WriteLine("AppWarehouse.pro: " + ex.Message);
Debug.WriteLine("AppWarehouse.pro: " + ex.StackTrace);
return null;
}
}
我不明白它为什么会这样做。对我来说,没有理由这样做。我很乐意修复或帮助修复它。
答案 0 :(得分:1)
我修好了......这是Xamarin结合装配的奇怪行为。