HttpResponseMessage创建HttpStatusCode 550

时间:2017-09-15 10:33:20

标签: c# rest api http

在Http Response Common中有550 Error,但我无法在HttpStatusCode Enumeration找到它。

JavaScriptSerializer sr = new JavaScriptSerializer();
OTPOutError_Model oError = new OTPOutError_Model();
oError.message = "Business exception. ";

var httpContent = new StringContent(sr.Serialize(oError), Encoding.UTF8, "application/json");
var msg = new HttpResponseMessage(HttpStatusCode.HttpVersionNotSupported) { ReasonPhrase = "550", Content = httpContent };
throw new HttpResponseException(msg);

如何退回响应状态550?是否有枚举更新?

在示例代码中,我使用505 / HttpStatusCode.HttpVersionNotSupported。我需要的是550而不是505。

0 个答案:

没有答案