更改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; }