从这个来源:http://www.tutorialsteacher.com/webapi/action-method-return-type-in-web-api,我知道Web API中的Action可以返回以下内容:
- void
- 基本类型或复杂类型
- HttpResponseMessage
- IHttpActionResult
IHTTPActionResult
的单元测试的链接时,你可以看到它们正在进行强制转换。所以比HttpResponseMessage
更容易,但不比选项1更容易。因此,它仍然是一个缺点。 - CodingYoshi