为什么'WriteLine()'函数没有在睡眠模式下写入? [英] why doesn't 'WriteLine()' function write in sleep mode?

查看:94
本文介绍了为什么'WriteLine()'函数没有在睡眠模式下写入?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



i开发一个Windows服务,这个服务应该在一个文本文件中写入日志(每5分钟一次),但是当系统进入睡眠模式时它不会写入。

为什么'WriteLine()'函数没有在睡眠模式下写入?

我该怎么办?我需要在几天内连续登录...请帮助我。

Hi,
i develop a windows service, this service should write log in a text file (per 5 minutes), but it isn't wrote when the system go to sleep mode.
why doesn't 'WriteLine()' function write in sleep mode?
what do i do? i need logs in all of times in several days ... please help me.

推荐答案

例如,请参阅此Stack Overflow问题:Windows Service OnPowerEvent [ ^ ]。
See, for instance, this Stack Overflow question: "Windows Service OnPowerEvent"[^].


考虑到系统处于睡眠模式时硬盘未启动和旋转,这并不奇怪。
Considering the hard drive isn't powered up and spinning while the system is in Sleep mode, this is no surprise.


转到任务管理器并查看条件选项卡下,您会看到唤醒计算机以运行此任务复选框。



这可以解决您的问题。
Go to Task Manager and looking under 'the Conditions' tab, you will find a "Wake the computer to run this task" check box.

This could resolve your issue.


这篇关于为什么'WriteLine()'函数没有在睡眠模式下写入?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆