windows-services - windows服务启动超时

标签 windows-services timeout startup

有没有办法为每个服务设置不同的服务启动超时值? 我可以使用 ServicesPipeTimeout 注册表项更改它,但它是针对每台计算机的 ( http://support.microsoft.com/kb/824344 )。

目前我唯一想到的就是在不同的线程中执行所有耗时的启动操作。

最佳答案

我同意 Romulo 的观点,即尽快完成启动您的服务。但是,如果您需要时间并且使用的是 .NET Framework 2.0 或更高版本,则可以考虑 ServiceBase.RequestAdditionalTime() 方法。

http://msdn.microsoft.com/en-us/library/system.serviceprocess.servicebase.requestadditionaltime.aspx

protected override void OnStart()
{
    this.RequestAdditionalTime(10000);
    // do your stuff
}

关于windows-services - windows服务启动超时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/216401/

相关文章:

google-chrome - Chrome 启动时从我离开的地方继续,再多一页

java - 在操作系统启动时自动运行 Java 应用程序

c# - Owin启动类和url

c# - 带服务和控制台的 System.Threading.Mutex

python - urlopen 随机卡住,超时被忽略

java - 使用 dbpedia 作为终点向 jena(对于 sparql)添加超时?

Java Socket.setSoTimeout() 在连接时不会超时

c# - 行为不当的 Screen.AllScreens.Length

sql-server - sql异常: No Process Is on the Other End of the Pipe

c# - 无法从 Windows 服务访问驱动器映射网络共享上的文件