问题描述
如何在解决方案中的启动项目之间增加一些延迟?
how to add some delay between startup projects in solution?
我希望在启动WindowsService的2-3秒后启动Client项目.
I want Client project to be started after 2-3 seconds from starting WindowsService.
我为什么需要这个?
推荐答案
我可能会在客户端中添加重试机制.这样,它不仅可以在从Visual Studio启动"的情况下提供帮助,而且 在实际客户端连接时服务器恰巧在重新启动的情况下也可以提供帮助.服务器位于更快的计算机上这一事实并不意味着服务器将永远不需要重新启动,是吗?
I would probably add a retry mechanism within the client. That way not only does it help in the "starting up from Visual Studio" case - it also helps if the server happens to be restarting while the real client connects. The fact that the server is on a faster machine doesn't mean the server will never need to restart, does it?
实际上,您可能希望以这种方式添加此重试机制,即使服务器在连接时 重新启动,客户端也可以恢复.当然,这取决于项目的工作.
Indeed, you may well want to add this retry mechanism in such a way that the client can recover even if the server is restarted while it's connected. It depends on what the project is doing, of course.
这篇关于Visual Studio在多个启动项目之间存在延迟?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!