[英]Web API post Body object is null
I have a Web api method like this 我有这样的Web api方法
[HttpPost]
public IHttpActionResult Login(ILogin request)
{
// do stuff
}
My Login object is 我的登录对象是
public interface ILogin
{
string UserName { get; set; }
string Password { get; set; }
}
I am trying to call from fiddler with the following details 我正尝试从提琴手打来电话,提供以下详细信息
url - myapi.com/login 网址-myapi.com/login
Request Body
请求正文
{ "UserName": "ingridmooney@insurity.com", "Password": "adfdfdf" }
I tried various combinations of request body - but whenever i debug - the ILogin request is always null. 我尝试了请求正文的各种组合-但无论何时调试-ILogin请求始终为null。 What am i doing wrong?
我究竟做错了什么?
You can't instantiate an interface. 您无法实例化接口。 Your webapi should expect a class that implements the ILogin interface.
您的webapi应该期望有一个实现ILogin接口的类。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.