[英]Auto restart of Application at machine restart hangs the application
I have a windows application developed in c#, starts automatically everyday when machine starts. 我有一个用c#开发的Windows应用程序,每天在计算机启动时自动启动。 By using this windows c# application we are launching an html application to show all the details which reads from this c# application.
通过使用此Windows c#应用程序,我们将启动html应用程序以显示从该c#应用程序读取的所有详细信息。 And this windows application before launches html, reads updated data from server if any available.
并且此Windows应用程序在启动html之前会从服务器读取更新的数据(如果有)。 My issue is when machine starts application also starts and unable to connect to server and goes idle and launches html application and the html application will not be able to communicate and get any data from the windows application.
我的问题是,当计算机启动时,应用程序也将启动,并且无法连接到服务器并进入空闲状态,并启动html应用程序,而html应用程序将无法通信并从Windows应用程序获取任何数据。
But when manually again stop and start the windows application it start connect to server and launch html with proper data. 但是,当再次手动停止并启动Windows应用程序时,它将开始连接到服务器并使用适当的数据启动html。
In registry settings we have give winlogon as c:\\myapplication.exe. 在注册表设置中,我们将winlogon命名为c:\\ myapplication.exe。 Is there any way to make my c# application should wait until the machine starts completely and load all network connections in the machine and later the application starts.
有什么方法可以让我的c#应用程序等待机器完全启动并加载机器中的所有网络连接,然后再启动应用程序。
Any suggestions. 有什么建议么。
Regards Sangeetha 关于Sangeetha
In this situation, I'd Check the connectivity of the system with server before launching the html page and do it every second or two. 在这种情况下,我将在启动html页面之前检查系统与服务器的连通性,并每隔一两秒钟进行一次。 Once I get the connectivity, I'd call the html page to display whatever is required.
获得连接后,我将调用html页面以显示所需的内容。
There are various options to achieve your result: 有多种选择可实现您的结果:
If your C# application is exposed as service , you could delay load the service with depends on 如果您的C#应用程序公开为service ,则可以延迟加载服务,具体取决于
3.You could use free program like Start Up Delayer to delay your program 3.您可以使用启动延迟器之类的免费程序来延迟程序
4.You could create an infinite loop in your c# program and break once all your dependencies are loaded. 4.您可以在c#程序中创建一个无限循环 ,并在加载所有依赖项后中断 。 Eg checking your are able to connect to the server and so on.
例如,检查您是否能够连接到服务器等等。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.