将状态代码设置为200以外的其他内容时是否可以使用OwinResponse.Write?
我在OwinMiddleware中有以下代码,但只要调用OwinResponse.Write,StatusCode总是设置为200 :(
response.OnSendingHeaders(state =>
{
var resp = (OwinResponse) state;
var message = string.Format(
"Max API concurrent calls quota exceeded, please try again later. Maximum admitted: {0}",
_maxConcurrentRequests);
resp.ReasonPhrase = message;
resp.Write(message);
resp.StatusCode = 429; // doesn't work here unless I comment out the line above
}, response);
答案 0 :(得分:1)
Too Many Requests
。