Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/37.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何创建从Android Studio应用程序到asp.net api控制器的改装帖子?_Android_Asp.net_Retrofit - Fatal编程技术网

如何创建从Android Studio应用程序到asp.net api控制器的改装帖子?

如何创建从Android Studio应用程序到asp.net api控制器的改装帖子?,android,asp.net,retrofit,Android,Asp.net,Retrofit,我想将Testclass作为Json发送到我的WebService。 因此,我使用改装 send(){ Retrofit r = new Retrofit.Builder() .baseUrl("http://hostname:77777") .addConverterFactory(GsonConverterFactory.create()) .build();

我想将Testclass作为Json发送到我的WebService。 因此,我使用改装

 send(){
    Retrofit r = new Retrofit.Builder()
                    .baseUrl("http://hostname:77777")
                    .addConverterFactory(GsonConverterFactory.create())
                    .build();

    UserApi service = r.create(UserApi.class);

service.sendData(new Test());
}

public interface UserApi{
@PUT("/api/values")
Call<Object> sendData(@Body Test test);
}
这里是c#

和我的控制器方法:

// POST api/values

public void Post([FromBody]Test value)
{
}

// PUT api/values/5
public String Put(string id, [FromBody]Test value)
{}
但这是行不通的。servermethodes没有被命中,我也没有得到错误警告或某种验证

知道我做错了什么吗

public class Test

{
    public String name { get; set; }
    public String street { get; set; }
}
// POST api/values

public void Post([FromBody]Test value)
{
}

// PUT api/values/5
public String Put(string id, [FromBody]Test value)
{}