サービススタック Web サービスのリクエストとレスポンスのペア全体をログに記録したいと考えています。応答ファイラーを見てきましたが、公開されているストリームは読み取り専用です。
質問する
4978 次
2 に答える
12
Have you seen ServiceStack's built-in Request Logger Plugin? It's a configurable In Memory, CSV or Redis Request Logger that maintains a log / (error responses) of the recent requests.
If you would like a different behaviour, you can implement and register your own IRequestLogger, it gets called for every request. It's log method gets called for every request with the following parameters.
Log(IRequest httpReq, object requestDto, object response, TimeSpan duration);
From the IRequest
you can get the original .NET Core/ASP.NET/HttpListener Request / Response types with
var originalReq = httpReq.OriginalRequest;
var originalRes = httpReq.OriginalResponse;
Filtering the response
Otherwise the ways to introspect the Response is with either
- The Response Filter or Response Filter Attributes; or
- Overriding OnAfterExecute() on your own base class that inherits from Rest/ServiceBase
于 2012-07-23T04:31:53.367 に答える