Ejemplo n.º 1
0
 private void TriggerQueueMonitoring()
 {
     using (CitrixQueueMonitorConnection client = CitrixQueueMonitorConnection.Create(_citrixServer))
     {
         foreach (CitrixQueueClientData data in _printClientData)
         {
             data.SessionStart = DateTime.Now;
             client.Channel.Subscribe(data);
             TraceFactory.Logger.Debug("{0} : {1}".FormatWith(data.SessionStart.ToString("yyyy-MM-dd HH:mm:ss.fff", CultureInfo.InvariantCulture), data.QueueName));
         }
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Tells the service to copy any logs that are unique to this resource.
        /// </summary>
        /// <returns>LogFileDataCollection.</returns>
        public override LogFileDataCollection GetLogFiles(string sessionId)
        {
            var logFiles = base.GetLogFiles(sessionId);

            // The individual office workers will handle themselves in terms of getting log data back.
            // But this method is used to get Citrix service log files and CSV files from the Citrix server.
            using (CitrixQueueMonitorConnection client = CitrixQueueMonitorConnection.Create(_citrixServer))
            {
                logFiles.Append(client.Channel.GetCitrixLogFiles(sessionId));
            }

            using (var client = new WcfClient <IPrintMonitorService>(MessageTransferType.Http, WcfService.PrintMonitor.GetHttpUri(_citrixServer)))
            {
                logFiles.Append(client.Channel.GetLogFiles());
            }

            return(logFiles);
        }
Ejemplo n.º 3
0
        public override void Cleanup()
        {
            TraceFactory.Logger.Info("Cleanup Session for {0}".FormatWith(_credential.UserName));
            try
            {
                // Give the Citrix server a few seconds to gracefully log the user off the session before
                // sending the death signal through the KillCitrixSession().
                Thread.Sleep(TimeSpan.FromSeconds(2));

                ChangeMachineStatusMessage("Logoff Citrix");

                CitrixSessionManager.ResetCitrixSession(_credential.UserName, _citrixServer);
                // CitrixSessionManager.RemoveFromAdminGroup(_credential, _citrixServer);

                // Send a delete request to the Citrix Monitor service and request a cleanup.  This will
                // proceed to remove the user profile directory from the server to keep the disk space under
                // control.
                TraceFactory.Logger.Debug("Sending delete request for: {0}".FormatWith(_userProfile));
                string citrixHost = _citrixServer;
                using (CitrixQueueMonitorConnection client = CitrixQueueMonitorConnection.Create(citrixHost))
                {
                    //client.Channel.Cleanup(_credential.UserName, _userProfile);
                    client.Channel.Cleanup(_credential);
                }

                //the user configuration file deletion is moved here from startup program to allow for retries to work - Veda
                string remotePath = @"\\{0}\C$\VirtualResource\UserConfiguration".FormatWith(_citrixServer);
                string datFile    = @"{0}\{1}.dat".FormatWith(remotePath, _credential.UserName);
                if (File.Exists(datFile))
                {
                    File.Delete(datFile);
                }

                // Now that the user is logged out, purge all print queues on the local machine.
                // This also occurs on the Citrix server, both have to be purged in order to++
                // ensure that there are no print jobs left in a queue after a completed test.
                TraceFactory.Logger.Debug("Purging local print queues...");
                PurgeLocalPrintQueues();
            }
            catch (Exception ex)
            {
                TraceFactory.Logger.Error("Error cleaning up Citrix session", ex);
            }
        }