在我的控制器下面我有2个方法使用Put和Patch动词,我想在不同的时间调用,因为你可以看到我试图传递json对象,但是当我运行项目并尝试调用时api我收到这个错误 " 找到了符合请求的多项操作"
我确信我弄乱了这条路线,但不知道我到底做错了什么,这里是控制器代码
[ApiVersion1RoutePrefix("tests")]
public class TestController : ApiController
{
[Route("{}", Name = "PackageDropOffLocation")]
[HttpPut]
[HttpPatch]
public IHttpActionResult PackageDropOffLocation(HttpRequestMessage, PackageDropOffLocationRequest packageDropOffLocationRequest)
{
return null;
}
[Route("", Name = "PackageOnBoard")]
[HttpPut]
[HttpPatch]
public IHttpActionResult PackageBoarded(HttpRequestMessage requestMessage, PackageBoardedRequest packageBoardedRequest)
{
return null;
}
}
public class PackageBoardedRequest
{
public string PackageId { get; set; }
}
public class PackageDropOffLocationRequest
{
public string Id { get; set; }
public double Longitude { get; set; }
public double Latitude { get; set; }
}
答案 0 :(得分:2)
问题出在Route属性中:
object