Пример #1
0
        public void Handle(HttpStatusCode statusCode, NancyContext context)
        {
            try
            {
                var lastError = context.GetException();

                //Lg.Error("来源:<br />" + lastError.Source + "<br />堆栈:<br />" + lastError.StackTrace + "<br />程序错误:<br />" + lastError.Message + "<br />页面:<br />" + context.Request.Url.Path + "<br />内部错误:<br />" + lastError.InnerException + "<br />");

                // context.Request.Path + context.Parameters;
                //var response =viewRenderer.RenderView(context, (int)statusCode + ".cshtml");
                //response.StatusCode = statusCode;
                //context.Response = response;
            }
            catch (Exception)
            {
                context.Response.StatusCode = statusCode;
            }
        }