使可执行文件以较低的优先级运行

Kei*_*ler 5 c# service windows-services

可能的重复:
在服务中设置线程优先级

我创建了一个 Windows 服务,我希望它始终以低优先级运行。有没有办法通过代码或我如何打包安装来实现这一点?

ESR*_*ogs 4

尝试修改System.Diagnostics.Process.GetCurrentProcess().PriorityClass和/或System.Threading.CurrentThread.Priority.

请注意:“进程中运行的具有不同优先级的线程相对于进程的优先级类别运行”(1)。此外,更改线程Priority的属性ThreadPool也没有效果。


1)http://msdn.microsoft.com/en-us/library/system.diagnostics.process.priorityclass.aspx
2)http://msdn.microsoft.com/en-us/library/system.threading.thread .priority.aspx