ReturnType typeof不能与Web API一起正常工作

时间:2018-12-30 14:01:58

标签: asp.net-web-api2

我有一个Web API方法,该方法应该返回Tag类型,但是即使返回其他类型也没有错误,为什么会这样?

[ResponseType(typeof(Tag))]
public IHttpActionResult PostTag(TagDTO tagDTO)

我返回了一个POST对象,它返回了JSON,序列化工作正常。

return CreatedAtRoute("DefaultApi", new { id = post.Tags.First().Id }, post);

0 个答案:

没有答案