本文整理汇总了C#中IHttpContext.FinalizeResonse方法的典型用法代码示例。如果您正苦于以下问题:C# IHttpContext.FinalizeResonse方法的具体用法?C# IHttpContext.FinalizeResonse怎么用?C# IHttpContext.FinalizeResonse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IHttpContext
的用法示例。
在下文中一共展示了IHttpContext.FinalizeResonse方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HandleActualRequest
public void HandleActualRequest(IHttpContext ctx)
{
var curReq = Interlocked.Increment(ref reqNum);
var sw = Stopwatch.StartNew();
try
{
DispatchRequest(ctx);
}
catch (Exception e)
{
HandleException(ctx, e);
logger.WarnFormat(e, "Error on request #{0}", curReq);
}
finally
{
ctx.FinalizeResonse();
logger.DebugFormat("Request #{0,4:#,0}: {1,-7} - {2,5:#,0} ms - {3} - {4}",
curReq, ctx.Request.HttpMethod, sw.ElapsedMilliseconds, ctx.Response.StatusCode, ctx.Request.Url.PathAndQuery);
}
}
示例2: HandleActualRequest
public void HandleActualRequest(IHttpContext ctx)
{
var sw = Stopwatch.StartNew();
bool ravenUiRequest = false;
try
{
ravenUiRequest = DispatchRequest(ctx);
}
catch (Exception e)
{
HandleException(ctx, e);
logger.Warn("Error on request", e);
}
finally
{
ctx.FinalizeResonse();
// we filter out requests for the UI because they fill the log with information
// we probably don't care about
if (ravenUiRequest == false)
{
var curReq = Interlocked.Increment(ref reqNum);
logger.DebugFormat("Request #{0,4:#,0}: {1,-7} - {2,5:#,0} ms - {3} - {4}",
curReq, ctx.Request.HttpMethod, sw.ElapsedMilliseconds, ctx.Response.StatusCode,
ctx.Request.Url.PathAndQuery);}
}
}
示例3: FinalizeRequestProcessing
private void FinalizeRequestProcessing(IHttpContext ctx, Stopwatch sw, bool ravenUiRequest)
{
LogHttpRequestStatsParams logHttpRequestStatsParam = null;
try
{
logHttpRequestStatsParam = new LogHttpRequestStatsParams(
sw,
ctx.Request.Headers,
ctx.Request.HttpMethod,
ctx.Response.StatusCode,
ctx.Request.Url.PathAndQuery);
}
catch (Exception e)
{
logger.WarnException("Could not gather information to log request stats", e);
}
ctx.FinalizeResonse();
sw.Stop();
if (ravenUiRequest || logHttpRequestStatsParam == null)
return;
LogHttpRequestStats(logHttpRequestStatsParam);
ctx.OutputSavedLogItems(logger);
}
示例4: HandleActualRequest
public void HandleActualRequest(IHttpContext ctx)
{
var sw = Stopwatch.StartNew();
bool ravenUiRequest = false;
try
{
ravenUiRequest = DispatchRequest(ctx);
}
catch (Exception e)
{
HandleException(ctx, e);
logger.Warn("Error on request", e);
}
finally
{
ctx.FinalizeResonse();
sw.Stop();
LogHttpRequestStats(ctx, sw, ravenUiRequest);
}
}