发送JSON Put方法-Xamarin.Forms时出错404

发送JSON Put方法-Xamarin.Forms时出错404,json,api,xamarin.forms,xamarin.android,request,Json,Api,Xamarin.forms,Xamarin.android,Request,我正在用Xamarin表单开发一个移动应用程序,我有一个问题,我的Put方法正在回复404状态,但是如果我在Postman上提出请求,它会工作得很好。。。 我看不出有什么问题 这是请求 public async Task<UserHasGamification> AddPointsToUser(UserHasGamification userHasGamification) { HttpClient client = new H

我正在用Xamarin表单开发一个移动应用程序,我有一个问题,我的Put方法正在回复404状态,但是如果我在Postman上提出请求,它会工作得很好。。。 我看不出有什么问题

这是请求

        public async Task<UserHasGamification> AddPointsToUser(UserHasGamification userHasGamification)
        {
            HttpClient client = new HttpClient();
            client.BaseAddress = new Uri("http://192.168.2.202:8080/api/UserGamification");
            client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));

            // Converte seu objeto para formato Json
            string json = JsonConvert.SerializeObject(userHasGamification);

            // Espera o resultado
            HttpResponseMessage response = await client.PutAsync("userHasGamification", new StringContent(json, Encoding.UTF8, "application/json"));

            if (response.IsSuccessStatusCode)
            {
                return userHasGamification;
            }
            return userHasGamification;
        }
以下是错误

{StatusCode: 404, ReasonPhrase: 'Not Found', Version: 1.1, Content: System.Net.Http.StreamContent, Headers:
{
  Cache-Control: no-cache
  Date: Sat, 29 Aug 2020 08:46:04 GMT
  Pragma: no-cache
  Server: Microsoft-IIS/10.0
  X-Android-Received-Millis: 1598690768707
  X-Android-Response-Source: NETWORK 404
  X-Android-Sent-Millis: 1598690768679
  X-AspNet-Version: 4.0.30319
  X-Powered-By: ASP.NET
  Content-Length: 122
  Content-Type: application/json; charset=utf-8
  Expires: -1
}}
get方法很好用…但是PUT方法不行…我不太明白为什么


有人能帮我吗?

你在《邮递员》中使用的URL是什么?我使用的是“”,这是我在C#中制作的API项目的URL,你使用的是
http://192.168.2.202:8080/api/UserGamification/userHasGamification
@Jason谢谢你,伙计……我的错!它起作用了now@JoãoGodinho Hi,如果你已经解决了这个问题,记得在有时间的时候分享答案。那么其他遇到这种情况的人就会知道如何解决这个问题。
{StatusCode: 404, ReasonPhrase: 'Not Found', Version: 1.1, Content: System.Net.Http.StreamContent, Headers:
{
  Cache-Control: no-cache
  Date: Sat, 29 Aug 2020 08:46:04 GMT
  Pragma: no-cache
  Server: Microsoft-IIS/10.0
  X-Android-Received-Millis: 1598690768707
  X-Android-Response-Source: NETWORK 404
  X-Android-Sent-Millis: 1598690768679
  X-AspNet-Version: 4.0.30319
  X-Powered-By: ASP.NET
  Content-Length: 122
  Content-Type: application/json; charset=utf-8
  Expires: -1
}}