What could possibly be wrong with the following method? The whole app hangs after calling the "await" line...
protected async Task<T> PostRequest<T>(string resourceEndpoint, JObject content)
{
Uri resourceAddress;
if (!Helpers.TryGetUri(serviceUri + resourceEndpoint, out resourceAddress))
{
return default(T);
}
var stringContent = new HttpStringContent(content.ToString());
HttpResponseMessage response = await httpClient.PostAsync(resourceAddress, stringContent);
JObject m = JsonConvert.DeserializeObject<JObject>(response.Content.ToString());
return JsonConvert.DeserializeObject<T>(m["array"].ToString());
}
I invoked request by SoapUI using this parameters and it went well.
This method is invoked here:
public async Task<User> Register(string name, string email, string password)
{
string path = "";
JObject content = JObject.FromObject(new RegisterParams() { name = name, email = email, password = password.ToMD5Hash() });
return await PostRequest<User>(path, content);
}
and that here:
public void Register()
{
user = userService.Register(LoginTextBox, EmailTextBox, PasswordTextBox).Result;
}