Beispiel #1
0
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="projectName">项目名</param>
        /// <param name="redisConfig">redis配置</param>
        public WcfMSClient(string projectName, string redisConfig = "localhost:6379")
        {
            if (string.IsNullOrEmpty(projectName))
            {
                throw new Exception("项目名不能为空!");
            }

            _projectName = projectName;
            _redisCache  = new RedisCache(redisConfig);
            WcfMSConfig config = _redisCache.GetCache <WcfMSConfig>(_configCacheKey);

            InitParamter(config);
        }
Beispiel #2
0
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="config">配置信息</param>
        public WcfMSServer(WcfMSConfig config)
        {
            if (string.IsNullOrEmpty(config.ProjectName))
            {
                throw new Exception("项目名不能为空!");
            }

            InitParamter(config);

            _redisCache = new RedisCache(_redisConfig);
            _redisCache.SetCache(_configCacheKey, config);
            CheckOnline();

            HttpRuntime.Cache[Guid.NewGuid().ToString()] = this;
        }