Esempio n. 1
0
        public static string CreateDianosticPageHtml(string serverName, Func <string, string> getHeaderValue)
        {
            RoutingTable.EnsureServerIsPrepared();
            StringBuilder html = new StringBuilder();

            html.AppendLine(@"<!DOCTYPE html>");
            html.AppendLine(@"<html><head>");
            html.AppendLine(@"<title>Diagnostic</title>");
            html.AppendLine(GetStylesBlock());
            html.AppendLine(GetScriptBlock());
            html.AppendLine(@"</head><body>");

            html.AppendFormat("{0}<hr/>", WorkSessionServerView.GetHeader(serverName));

            html.AppendFormat("{0}<hr/>", WorkSessionServerView.GetServersTable(getHeaderValue));

            if (RoutingTable.HasWorkSessions())
            {
                html.AppendFormat("{0}<hr/>", WorkSessionServerView.GetWorkSessionTable());
            }

            html.AppendFormat("{0}<hr/>", WorkSessionServerView.GetTraceLog());

            html.AppendLine(@"</body></html>");

            return(html.ToString());
        }
Esempio n. 2
0
        static void DoRequestRouting(HttpApplication application, string workSessionID)
        {
            RoutingTable.EnsureServerIsPrepared();

            WorkSessionServerInfo serverInfo = RoutingTable.GetWorkSessionServerInfoByWorkSessionID(workSessionID);

            if (serverInfo != null && serverInfo.Status != WorkSessionServerStatus.Online)
            {
                throw new Exception("WorkSession is not available");
            }

            if (serverInfo == null && !HeaderCookieHelper.HasServerAffinity(application, RoutingConfiguration.AffinityCookieName))
            {
                serverInfo = RoutingTable.FindAvailableServerForNewWorkSession();
            }

            if (serverInfo != null && RoutingConfiguration.UseCookie)
            {
                FarmConfigurationManager.AddServer(serverInfo.HostServerIP, 8080);
                string newCookieValue = ARRHashHelper.CalculateHash(serverInfo.HostServerIP);
                HeaderCookieHelper.PatchHeaderCookieGUID(application, RoutingConfiguration.AffinityCookieName, newCookieValue);
            }
        }