c# - Error converting value "Any Value" to type 'System.Web.Http.IHttpActionResult' -
i'm getting error when call web api
method returns bool
(edit - object, error comes hub attribute):
error converting value true type 'system.web.http.ihttpactionresult
this method:
[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); }
edit: offending code in hub attribute:
public override async void onactionexecuted(httpactionexecutedcontext actionexecutedcontext) { ... if (hub != null) { // line throws error var response = await actionexecutedcontext.response.content.readasasync(actionexecutedcontext.actioncontext.actiondescriptor.returntype); hub.clients.all.invoke(outgoingmethod, new { time = datetime.now.tostring("g"), data = response }); } }
from fiddler , browsers, 200 response , correct return value, visual studio throws error. causing error?
Comments
Post a Comment