I’m trying to upload an image to a server but keep getting http 503 service unavailable or error code 1200. I know the server is too busy, but the others can upload their images successfully – what am I doing wrong?
Here is my code:
private async Task UploadImage()
{
while (true)
{
try
{
var request = new HttpRequestMessage(HttpMethod.Post, "Submission/Home/AjaxPhotoUpload");
var content = new MultipartFormDataContent
{
{
new StreamContent(File.OpenRead(_citizen.PhotoPath)), _citizen.imageUpload , _citizen.FileNameWithExt
},
{
new StringContent("-1"), "subDocIndex"
}
};
request.Content = content;
var response = await _httpClient.SendAsync(request);
if (response.IsSuccessStatusCode)
{
Console.WriteLine("uploaded image");
break;
}
else
{
Console.WriteLine("FAILED to upload image");
}
// var result = await response.Content.ReadAsStringAsync();
}
catch (Exception e)
{
Console.WriteLine(e);
}
}
}
ServerConnected: 12:00:02.205
FiddlerBeginRequest: 12:01:41.885
ServerGotRequest: 12:01:41.885
ServerBeginResponse: 12:02:23.100
GotResponseHeaders: 12:02:23.100
ServerDoneResponse: 12:02:23.100
ClientBeginResponse: 12:02:23.100
ClientDoneResponse: 12:02:23.100
It’s Fiddler statistics..
I
tried it with 8 dedicated server and different ips. result same