Пример #1
0
        private void CreateWcfClient()
        {
            const string configKeyEndpoint = "ServiceUpdateHost";
            var          endpointAddress   = "http://localhost:55050/ServerUnitManager";

            if (ConfigurationManager.AppSettings.AllKeys.Contains(configKeyEndpoint))
            {
                endpointAddress = ConfigurationManager.AppSettings[endpointAddress];
            }

            if (string.IsNullOrEmpty(endpointAddress))
            {
                return;
            }

            try
            {
                var myBinding        = new BasicHttpBinding();
                var myEndpoint       = new EndpointAddress(endpointAddress);
                var myChannelFactory = new ChannelFactory <IServerUnitManager>(myBinding, myEndpoint);
                serverUnitManager = myChannelFactory.CreateChannel();
            }
            catch (Exception ex)
            {
                LogHelper.InfoFormat("Ошибка в CreateWcfClient: " + ex);
                serverUnitManager = null;
            }
        }
Пример #2
0
 private void ReportProgressForLocalServerUnitManager(int filesUpdated, int filesLeft, bool finished)
 {
     if (serverUnitManager == null)
     {
         return;
     }
     try
     {
         serverUnitManager.UpdateServiceFilesStates(ExecFileFolder,
                                                    filesUpdated, filesLeft, finished);
     }
     catch (Exception ex)
     {
         LogHelper.Error("Ошибка в UpdateServiceFilesStates", ex);
         serverUnitManager = null;
     }
 }