압축 용 응답 필터를 추가 할 HTTP 모듈이 있습니다. 이것은 MetaData에 대한 호출 인 1을 제외한 모든 API 호출에서 작동합니다. [BreezeController] 장식을 제거하면 잘 동작합니다. 문자열 컨텐츠를 가진 HttpResponse 리턴 유형으로 문자열 리턴 유형을 변환하는 조치 필터 속성과 관련이 있다고 생각합니다.압축 응답 필터가 breeze.js에서 실패합니다. 메타 데이터 호출
내가받는 오류는 "예외 메시지 : 기본 압축 루틴의 스트림 상태가 일관성이 없습니다."입니다.
HttpResponse를 반환하도록 정의 된 메서드가 제대로 작동하는 일부 테스트를 수행했습니다. 그래서 나는 그 메소드가 문자열을 반환하도록 정의 된 시나리오를 생각하고, 액션 필터는 런타임에 그것을 HttpResponse로 변경합니다.
어떻게하면이 아이디어를 얻을 수 있습니까?
HttpApplication app = (HttpApplication)sender;
// Check the header to see if it can accept compressed output
string encodings = app.Request.Headers.Get("Accept-Encoding");
if (encodings == null)
return;
Stream s = app.Response.Filter;
encodings = encodings.ToLower();
if (encodings.Contains("gzip"))
{
app.Response.Filter = new GZipStream(s, CompressionMode.Compress);
app.Response.AppendHeader("Content-Encoding", "gzip");
}