コード例 #1
0
        public LoadBalanceConfigurator EnableLoadBalanceServer(int maxAttemptsToGetAvailableSubServer = 3,
                                                               bool cacheResultsForUnreachableServers = false)
        {
            EnableBasicServerController(new LoadBalanceServer());
            if (cacheResultsForUnreachableServers)
            {
                LoadBalanceServer.EnableCachedResultsForUnreachableServers();
            }

            AttemptsToGetSubServerAvailable = maxAttemptsToGetAvailableSubServer;
            return(new LoadBalanceConfigurator());
        }
コード例 #2
0
        /// <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());
        }