public BaseInfo() { ID = Guid.NewGuid().ToString(); AppName = CommonConfiguration.GetConfig().ApplicationName; MachineIP = CommonConfiguration.MachineIP; ServerTime = DateTime.Now; }
internal static ChannelFactory <IConfigServer> CreateServiceClient() { string typeName = typeof(IConfigServer).FullName; ChannelFactory cf; if (!_channelFactoryCache.TryGetValue(typeName, out cf)) { lock (_locker) { if (!_channelFactoryCache.TryGetValue(typeName, out cf)) { var configServiceAddress = CommonConfiguration.GetConfig().ConfigServiceAddress; var binding = new NetTcpBinding(); binding.Security.Mode = SecurityMode.None; binding.MaxReceivedMessageSize = 655360000; binding.SendTimeout = TimeSpan.FromMinutes(10); var address = string.Format("net.tcp://{0}", configServiceAddress); cf = new ChannelFactory <IConfigServer>(binding, address); if (cf != null) { _channelFactoryCache[typeName] = cf; } } } } return((ChannelFactory <IConfigServer>)cf); }
internal static WcfChannelWrapper <T> CreateServiceClient <T>() where T : class { try { string typeName = typeof(T).FullName; ChannelFactory cf; if (!channelFactoryCache.TryGetValue(typeName, out cf)) { lock (cacheLocker) { if (!channelFactoryCache.TryGetValue(typeName, out cf)) { if (typeof(T) == typeof(IWcfConfigService)) { var configServiceAddress = CommonConfiguration.GetConfig().WcfConfigServiceAddress; var binding = new NetTcpBinding(); binding.Security.Mode = SecurityMode.None; var address = string.Format("net.tcp://{0}", configServiceAddress); cf = new ChannelFactory <IWcfConfigService>(binding, address); } else if (typeof(T) == typeof(IConfigServer)) { var configServiceAddress = CommonConfiguration.GetConfig().ConfigServiceAddress; var binding = new NetTcpBinding(); binding.Security.Mode = SecurityMode.None; binding.MaxReceivedMessageSize = 6553600; //var address = string.Format("net.tcp://{0}", configServiceAddress); cf = new ChannelFactory <IConfigServer>(binding, configServiceAddress); } else { var endpoint = GetWcfClientEndpointConfiguration(typeof(T)); cf = CreateChannelFactory <T>(endpoint); WcfSettingManager.Init <T>(); } if (cf != null) { channelFactoryCache[typeName] = cf; } } } } return(new WcfChannelWrapper <T>((cf as ChannelFactory <T>).CreateChannel())); } catch (Exception ex) { ex.Handle(WcfLogProvider.ModuleName, "WcfServiceClientFactory", "CreateServiceClient"); throw; } }
public void Init() { _syncConfigCacheThread = new Thread(SyncConfigCacheWorker); _appName = CommonConfiguration.GetConfig().ApplicationName; RegisterApplication(_appName); EnsureTypeRepositoryItemAdded(); EnsureUnderlyingTypeItemAdded(); EnsureBooleanTypeItemAdded(); BatchLoadConfigItems(); _syncConfigCacheInterval = GetConfigItemValue(true, this.GetType().FullName, "SyncConfigCacheInterval", DefaultSyncConfigCacheInterval, SyncConfigCacheIntervalUpdateCallback); _actionNumRetries = GetConfigItemValue(true, this.GetType().FullName, "ActionNumRetries", DefaultActionNumRetries, ActionNumRetriesUpdateCallback); _actionRetryTimeout = GetConfigItemValue(true, this.GetType().FullName, "ActionRetryTimeout", DefaultActionRetryTimeout, ActionRetryTimeoutUpdateCallback); _tryCreateConfigItemIfNotExists = GetConfigItemValue(true, this.GetType().FullName, "TryCreateConfigItemIfNotExists", _tryCreateConfigItemIfNotExists); _batchLoadSize = GetConfigItemValue(true, this.GetType().FullName, "BatchLoadSize", DefaultBatchLoadSize); _syncConfigCacheThread.IsBackground = true; _syncConfigCacheThread.Start(); }
public StateServiceConfigurationItem() { TypeFullName = ""; Enabled = false; ReportStateIntervalMilliSeconds = CommonConfiguration.GetConfig().StateServiceDefaultReportStateIntervalMilliSeconds; }