asp.net 웹 API 프로젝트에서 미니 프로파일 러를 사용하고 있으며 사용자 정의 DelegatingHandler에서 실행되는 일부 코드의 성능을 추적하려고합니다.System.Net.Http.DelegatingHandler에서 MiniProfiler.Current가 호출되면 null입니다.
DelegatingHandler
안에있는 MiniProfiler.Current.Step()
은 결과에 표시되지 않습니다. 같은 프로젝트에있는 다른 전화가 괜찮습니다.
MiniProfiler.Current
은 WebRequestProfilerProvider
에서 HttpContext.Current
으로부터 검색된 것으로 밝혀졌다. DelegatingHandler
에서 호출하면 HttpContext.Current
이 null입니다.
처리기 내에서 작동하도록 MiniProfiler.Current를 검색하는 더 좋은 방법이 있습니까?
어쩌면 이것이 당신의 질문에 대한 대답 -. HttpCache에, 그것은 두 번째 옵션에
주 이동합니다.? [MvcMiniProfiler가 작동하려면 웹 응용 프로그램이 필요합니까, 아니면 단위 테스트와 같이 순수 라이브러리에서 사용할 수 있습니까?] [1] [1] : http://stackoverflow.com/questions/8526609/does-mvcminiprofiler-require-a-web-application-to-work-or-can-it-be-used-in- pur –