private bool isrun;protected override void OnStart(string[] args) { isrun =true; while (isrun) { try { StreamWriter sw = File.AppendText(@"d:\myserver.txt"); sw.WriteLine(string.Format("服务启动,启动时间{0}", DateTime.Now)); } } catch (Exception ex) { WirteWinLog(ex); } System.Threading.Thread.Sleep(10*1000); } } protected override void OnStop() { isrun=false; StreamWriter sw = File.AppendText(@"d:\myserver.txt"); sw.WriteLine(string.Format("服务停止,启动时间{0}", DateTime.Now)); sw.Close(); }为什么服务发布后无法停止呢????
- 2 回答
- 0 关注
- 1157 浏览
添加回答
举报
0/150
提交
取消