我正在尝试使用“Request”从一个POST Web API操作返回一个
HttpResponseException
:throw new HttpResponseException(Request.CreateErrorResponse(HttpStatusCode.NotFound, "File not in a correct size"));
这样做时,我得到了“值不能为 null。参数名: request”。
本质上 - 请求是 null。
我错过了什么?
谢谢
throw new HttpResponseException(HttpStatusCode.NotFound)
。 - Rwitithrow new HttpResponseException(new HttpResponseMessage(HttpStatusCode.InternalServerError) { Content = new StringContent("Invalid size"), StatusCode = HttpStatusCode.Forbidden });
但是在客户端(JS)上,我无法获取“Content”属性。有什么想法吗? - Leo