Ejemplo n.º 1
0
        protected override void OnStart(string[] args)
        {
            JLogger.LogInfo(this, "OnStart() Start");

            if (_wl == null)
            {
                _wl = new WatcherLoader();
            }

            _wl.StartWatchers();

            JLogger.LogInfo(this, "OnStart() End");
        }
Ejemplo n.º 2
0
        public void Start()
        {
            JLogger.LogInfo(this, "Start() In");

            //INIT REMOTE OPERATIONS
            _factHandlerClient = new SRMServerAccess();

            //Enroll Machine
            //JMachine.Id = _factHandlerClient.EnrollMachine(JMachine.GetMachine());

            //Get Configuration
            //_factHandlerClient.GetMachineConfiguration(_machine);

            //Start CommandService
            try
            {
                JLogger.LogDebug(this, "Se crea el service host con la direccion base.");
                var baseAddress = new Uri("http://localhost:8080/CommandService");
                _commandService = new ServiceHost(typeof(CommandService), baseAddress);

                JLogger.LogDebug(this, "Se configura para presentar el metadata.");
                var smb = new ServiceMetadataBehavior
                {
                    HttpGetEnabled   = true,
                    MetadataExporter = { PolicyVersion = PolicyVersion.Policy15 }
                };
                _commandService.Description.Behaviors.Add(smb);

                JLogger.LogDebug(this, "Se Abre la comunicacion.");
                _commandService.Open();
            }
            catch (Exception ex)
            {
                JLogger.LogError(this, "Error al crear el host.", ex);
            }

            //Start Watchers
            _watcherLoader = new WatcherLoader();
            _watcherLoader.StartWatchers();

            JLogger.LogInfo(this, "Stop() Out");
        }
Ejemplo n.º 3
0
        // ReSharper disable once UnusedParameter.Local
        private static void Main(string[] args)
        {
            //ENROLL MACHINE
            var hostName   = Dns.GetHostName();
            var ipHostInfo = Dns.GetHostEntry(hostName);
            var ipAddress  = Convert.ToString(ipHostInfo.AddressList.FirstOrDefault(address => address.AddressFamily == AddressFamily.InterNetwork));

            int id = ServerAccess.EnrollMachine(new Machine()
            {
                Ip = ipAddress, Name = hostName
            });
            //GET CONFIGURATION

            //ENABLE WATCHERS
            var wl = new WatcherLoader();

            wl.StartWatchers();

            Console.WriteLine("Press Any Key to stop");
            Console.ReadKey();
            wl.StopWatchers();
        }