# gt.webapi **Repository Path**: gt1987/gt.webapi ## Basic Information - **Project Name**: gt.webapi - **Description**: 针对webapi项目,通过初始化的方式 实现以下功能:1.提供一致化处理 统一的Request Response ErrorCode 2.API 客户端身份管理+AUTH 验证方式+扩展 3.API访问日志记录 4.通用的异常处理 5.API访问ip限制+频率限制。 满足大部分webapi项目基本功能需求 - **Primary Language**: C# - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 20 - **Forks**: 5 - **Created**: 2017-10-24 - **Last Updated**: 2023-08-20 ## Categories & Tags **Categories**: webframework **Tags**: None ## README # gt.webapi create webapi project sample,try to practice some components. using owin katana,gtTarget 学习参考 提供Api开发辅助类 1.提供一致化处理 统一的Request Response ErrorCode 2.API 客户端身份管理+AUTH 验证方式 3.日志记录 4.异常处理 5.访问ip限制 6.访问频率限制 # 初始化方式 var clients = GetClients(); WebApiCoreOption coreConfig = new WebApiCoreOption { Authority = new AuthorityOption(clients). UsingAuthentication(new CustomerAuthenticationAttribute(), new DefaultAuthorizeAttribute(new gt.webapi.core.Repositories.Impl.MemoryAuthorityRepository())), Log = new LogOption(new FileLogWrapper("ApiLogger"), new FileLogWrapper("ErrorLogger")), //IpLimit = new IpLimitOption(new List { "127.0.0.1" }), //RateLimit = new RateLimitOption("test", new Dictionary { { RateLimitPeriod.Minute, 10 } }) }; config.RegisterWebApiCore(coreConfig); config.Formatters.Remove(config.Formatters.XmlFormatter);