0
我在我的代碼中使用了一個post函數,但有時它會發生超時,持續時間不是問題,但我需要代碼等待響應。 使用此代碼:在Xamarin的帖子表單中延長超時時間
using (var client = new HttpClient())
using (var formData = new MultipartFormDataContent())
{
formData.Add(Hdata, "data", "data");
formData.Add(Hclient, "client", "client");
formData.Add(Hpage, "page", "page");
formData.Add(Hloop, "loop", "loop");
formData.Add(Hproperties, "properties", "properties");
formData.Add(Hrelation, "user", "user");
formData.Add(Hbinary, "binary", "binary");
requestMessage.Content = formData;
//client.Timeout = TimeSpan.FromSeconds(300);;
var response = client.SendAsync(requestMessage, HttpCompletionOption.ResponseContentRead);
using (StreamReader sr = new StreamReader(response.Result.Content.ReadAsStreamAsync().Result))
{
if (sr != null)
{
json = sr.ReadToEnd();
}
}
}
試圖在過去的很多事情,但他們的工作不,有人可以告訴我怎麼辦?
更新:忘了這是一個Xamarin Visual Studio項目
對不起,其Xamarin項目 – user3763117
然後我不知道很抱歉 –