// Pre user config public static void ConfigureHost(IAppHost appHost, string serviceName, ServiceManager serviceManager) { AppHost = appHost; EndpointHostConfig.Instance.ServiceName = serviceName; EndpointHostConfig.Instance.ServiceManager = serviceManager; var config = EndpointHostConfig.Instance; Config = config; // avoid cross-dependency on Config setter VirtualPathProvider = new FileSystemVirtualPathProvider(AppHost, Config.WebHostPhysicalPath); Config.DebugMode = appHost.GetType().Assembly.IsDebugBuild(); if (Config.DebugMode) { Plugins.Add(new RequestInfoFeature()); } }
// Pre user config public static void ConfigureHost(IAppHost appHost, ServiceManager serviceManager) { Reset(); AppHost = appHost; Config.ServiceManager = serviceManager; Config.DebugMode = appHost.GetType().Assembly.IsDebugBuild(); Plugins.Add(new BaijiJsonFormat()); Plugins.Add(new HtmlFormat()); Plugins.Add(new PredefinedRoutesFeature()); Plugins.Add(new MetadataFeature()); Plugins.Add(new ConfigInfoPlugin()); Plugins.Add(new CustomOperationPlugin()); Plugins.Add(new OperationInfoPlugin()); Plugins.Add(new RouteInfoPlugin()); if (Config.DebugMode) { Plugins.Add(new RequestInfoFeature()); } // By default, enable hystrix info for real-time preformance monitoring & troubleshooting Plugins.Add(new HystrixInfoFeature()); Plugins.Add(new CrossDomainPlugin()); Plugins.Add(new IPWhiteListPlugin()); Plugins.Add(new AppIdWhiteListPlugin()); Plugins.Add(new IPBlackListPlugin()); Plugins.Add(new AppIdBlackListPlugin()); Plugins.Add(new IPRateLimitingPlugin()); Plugins.Add(new AppIdRateLimitingPlugin()); Plugins.Add(new OperationRateLimitingPlugin()); Plugins.Add(new ServiceRateLimitingPlugin()); Plugins.Add(new SimpleAuthPlugin()); Plugins.Add(new AsyncRequestCounterPlugin()); }