/// <summary> /// Enables load balancing features on the current server /// </summary> /// <param name="maxAttemptsToGetAvailableSubServer">In a pool of sub-servers, determines the maximum number of attempts to obtain an eligible server to meet the request from the connected client</param> /// <param name="cacheResultsForUnreachableServers">If the number of attempts to obtain a server from the pool has exceeded, it will return a cache of the last request successfully made in the controller/action</param> /// <returns></returns> protected LoadBalanceConfigurator EnableLoadBalanceServer(int maxAttemptsToGetAvailableSubServer = 3, bool cacheResultsForUnreachableServers = false) { ICoreServerService coreServer = Services.GetService <ICoreServerService>("realserver"); coreServer.EnableBasicServerProcessorMode(typeof(LoadBalanceServer)); if (cacheResultsForUnreachableServers) { LoadBalanceServer.EnableCachedResultsForUnreachableServers(); } LoadBalanceServer.SetAttemptsToGetSubServerAvailable(maxAttemptsToGetAvailableSubServer); return(new LoadBalanceConfigurator()); }
public override void ConfigureServices(IServiceManager serviceManager) { ICoreServerService coreServer = serviceManager.GetService <ICoreServerService>("realserver"); coreServer.EnableBasicServerProcessorMode(typeof(BasicServer)); }