ASP.NET MVC를 사용하여 REST API를 구현하고 있으며 요청에 대한 요청 헤더가 Expect: 100-continue
인 간단한 걸림돌이 있습니다. 게시물 몸체.ASP.NET MVC에서 "Expect : 100-continue"헤더 지원
Upon receiving a request which includes an Expect request-header field with the "100-continue" expectation, an origin server MUST either respond with 100 (Continue) status and continue to read from the input stream, or respond with a final status code. The origin server MUST NOT wait for the request body before sending the 100 (Continue) response. If it responds with a final status code, it MAY close the transport connection or it MAY continue to read and discard the rest of the request. It MUST NOT perform the requested method if it returns a final status code.
이것은 내가 즉이 즉시 HTTP 100 응답을 계속 보낼 필요, 요청에 이 응답을해야하고 읽는 계속처럼 나에게 소리 :
RFC 2616 상태에 있음 요청을 끝내지 않고 원본 요청 스트림 (즉, HttpContext.Request.InputStream
)을 보내고 최종적으로 결과 상태 코드를 보냅니다 (인수로 인해 204 내용 없음 결과가 표시됨).
그래서, 질문이 있습니다 : 내가 사양 권리를 읽는
- 오전, 내가 요청에 두 응답을 할 필요가?
- 어떻게 ASP.NET MVC에서이 작업을 수행 할 수 있습니까?
w.r.t. (2)이 입력 스트림을 읽어 진행하기 전에 다음과 같은 코드를 사용하여 시도 ...
HttpContext.Response.StatusCode = 100;
HttpContext.Response.Flush();
HttpContext.Response.Clear();
...하지만 최종 204 상태 코드를 설정하려고 할 때 오류 얻을 :
을System.Web.HttpException: Server cannot set status after HTTP headers have been sent.
아니요 - 나는 그것을 피하고 싶습니다! IIS가 개입하지 않고도 IIS를 처리 할 수 있다는 것을 깨닫지 못했습니다. –
100 Continue로 'WebRequest'에 버그가 발생했습니다. 그것은 그것을 사용하지 않는 좋은 이유입니다. http://regis.decamps.info/blog/2010/12/c-bug-in-webrequest/ – rds