protected void Application_Error() { var exception = Server.GetLastError(); if (exception == null) { return; } var log = WebContainerManager.Get <ILogManager>().GetLog(typeof(WebApiApplication)); log.Error("Unhandled exception.", exception); }
public static void Register(HttpConfiguration config) { var provider = new StringParameterBinderProvider(new StringParameterBinder(), typeof(string)); config.Services.Insert(typeof(ModelBinderProvider), 0, provider); config.Services.Replace(typeof(ITraceWriter), new LogWriter(WebContainerManager.Get <ILogManager>())); config.Services.Add(typeof(IExceptionLogger), new ExceptionLogger(WebContainerManager.Get <ILogManager>())); config.BindParameter(typeof(string), new StringParameterBinder()); config.MapHttpAttributeRoutes(); config.Routes.MapHttpRoute( "DefaultApi", "api/{controller}/{id}", new { id = RouteParameter.Optional }); }