转换值时出错"任何值"输入' System.Web.Http.IHttpActionResult'

时间:2015-08-19 19:06:40

标签: c# asp.net-web-api

当我调用返回Web API的{​​{1}}方法时,我收到此错误(编辑 - 任何对象,错误来自Hub属性) :

  

将值True转换为类型' System.Web.Http.IHttpActionResult

时出错

这是方法:

bool

编辑:这是Hub属性中的违规代码:

    [HttpGet]
    [Hub(Name = "ServiceLog", IncomingMethod = "logIncoming", OutgoingMethod = "logOutgoing")]
    [ResponseType(typeof(bool))]            
    public async Task<IHttpActionResult> TestMethodAsync(int i)
    {
        var result = await _repository.TestMethodAsync(i).ConfigureAwait(false);
        return Ok(result);
    }

从Fiddler和浏览器中,我得到200响应和正确的返回值,但Visual Studio会抛出错误。导致此错误的原因是什么?

0 个答案:

没有答案