【发布时间】:2020-10-03 12:07:09
【问题描述】:
谁能帮我找出解决办法?我需要使用 POST 方法注册数据,从 Body 发送参数。我正在使用此代码
public static async Task<HttpResponseMessage> Signup(Register register)
{
HttpResponseMessage result=null;
try
{
string url = Constant.url + "api/services/app/Account/Register";
HttpClient _client = new HttpClient();
var content = JsonConvert.SerializeObject(register);
result = await _client.PostAsync(url, new StringContent(content, Encoding.UTF32, "application/json"));
}
catch(Exception ex)
{
}
return result;
}
但我收到 500 内部服务器错误。请帮助我。
【问题讨论】:
-
检查您的 api 代码和 api 错误日志以获取更多信息
-
在不知道您向服务器发送什么以及服务器期望什么的情况下,没有人可以帮助您解决问题。 500 也表示服务器有问题。所以你必须检查和服务器的代码,看看有什么问题
标签: android android-studio xamarin.android http-post webapi