更改windows服务的配置文件app.config

        /// <summary>
        /// 获取每次处理记录数
        /// </summary>
        /// <returns></returns>
        private static int GetRecordCount()
        {
            int recordCount = 10000;
            try
            {
                ConfigurationManager.RefreshSection("appSettings");// 刷新命名节,在下次检索它时将从磁盘重新读取它。
                recordCount = Math.Abs(int.Parse(ConfigurationManager.AppSettings["RecordCount"]));
                if (recordCount == 0)
                {
                    recordCount = 10000;
                }
            }
            catch
            {
                recordCount = 10000;
            }
            return recordCount;
        }
posted @ 2013-12-18 17:20  任崸  阅读(676)  评论(0编辑  收藏  举报