Reputation: 23
Seriously i search a lot upload file from WP8 to server. it's doesn't work :(
Why i get this error?? it's the error is because my FileuploadUrl?
System.Net.Http.HttpRequestException: Response status code does not indicate success: 405 (Method Not Allowed)
private async void UploadFile()
{
try
{
if (photoStream != null)
{
//var fileUploadUrl = @"http://<IPaddress>:<port>/fileupload";
var fileUploadUrl = @"http://www.comevox.com:80/services";
var client = new HttpClient();
photoStream.Position = 0;
MultipartFormDataContent content = new MultipartFormDataContent();
content.Add(new StreamContent(photoStream), "file", fileName);
await client.PostAsync(fileUploadUrl, content)
.ContinueWith((postTask) =>
{
postTask.Result.EnsureSuccessStatusCode();
});
}
btnUpload.IsEnabled = false;
imgSelectedImage.Source = null;
txtMessage.Visibility = Visibility.Visible;
}
catch
{
txtError.Visibility = Visibility.Visible;
}
}
}
Upvotes: 0
Views: 703
Reputation: 9863
Fixing 405 errors - general
405 errors often arise with the POST method. You may be trying to introduce some kind of input form on the Web site, but not all ISPs allow the POST method necessary to process the form.
All 405 errors can be traced to configuration of the Web server and security governing access to the content of the Web site, so should easily be explained by your ISP.
Upvotes: 0