46 lines
No EOL
1.6 KiB
C#
46 lines
No EOL
1.6 KiB
C#
using NLog;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Web.Http;
|
|
using System.Web.Http.Filters;
|
|
|
|
namespace ULA.Cathay.ModuloMantenimiento
|
|
{
|
|
public static class WebApiConfig
|
|
{
|
|
public static void Register(HttpConfiguration config)
|
|
{
|
|
config.Routes.MapHttpRoute(
|
|
name: "DefaultApi",
|
|
routeTemplate: "api/{controller}/{action}/{id}/{id2}",
|
|
defaults: new { id = RouteParameter.Optional, id2 = RouteParameter.Optional }
|
|
);
|
|
|
|
// config.Routes.MapHttpRoute(
|
|
// name: "CotejarTarjetasAPI",
|
|
// routeTemplate: "api/DistribucionAPI/CotejarTarjetas/{numCuenta}",
|
|
// defaults: new { numCuenta = RouteParameter.Optional }
|
|
//);
|
|
|
|
config.Filters.Add(new UnhandledExceptionFilter());
|
|
|
|
// Uncomment the following line of code to enable query support for actions with an IQueryable or IQueryable<T> return type.
|
|
// To avoid processing unexpected or malicious queries, use the validation settings on QueryableAttribute to validate incoming queries.
|
|
// For more information, visit http://go.microsoft.com/fwlink/?LinkId=279712.
|
|
//config.EnableQuerySupport();
|
|
}
|
|
}
|
|
|
|
public class UnhandledExceptionFilter : ExceptionFilterAttribute
|
|
{
|
|
public override void OnException(HttpActionExecutedContext context)
|
|
{
|
|
|
|
Logger logger = LogManager.GetLogger("WebApiConfig");
|
|
|
|
logger.Fatal("[WebApiApplication / Application_Error] " + context.Exception.ToString());
|
|
|
|
}
|
|
}
|
|
} |