WinForms Form Hangs on Startup on One Machine
For my VB.NET application, I'm using the windows installer that came with Visual Studio. I can successfully install and run my program on any computer in our开发者_StackOverflow社区 office except for one. On this particular machine, my program will stall for about 30 seconds before being able to load the main form. When I start up the task manager, the CPU is hovering at about 0 to 1%, so its not really doing anything but freezing up. It will eventually load, but it really shouldnt take this long, especially when it loads instantly on other computers. Now this machine is windows xp with serverice pack 3 and .net 3.5 sp1. Can you guys think of anything that would cause this?
You could use Process Monitor to find out what your program is doing while it is stalling. Maybe it's trying to access some network resource that is unavailable and has to wait for a timeout...
Do you get this result every time the application loads, or just the first time? If the latter, you may be able to ngen it.
Does the application connect to any outside resources? For example, a database or network share. If so, can you test the conditions around that?
Use Run->services.msc to check that all the same services are starting on the machine in question that are starting on all the other machines. It sounds like a service is loading "manually" on the machine in question (hence the delay) and loads automatically on the other machines. as mentioned above Process Monitor (a part of the MS Sysinternals Suite ) can be very helpful
Edit: you said the task manager, the CPU is hovering at about 0 to 1%, does that include Kernel Time? By default Task Manager does not display Kernel Times you have to Select View from the menubar then click on Show Kernel Times from the drop down menu. Kernel activities can be quite significant while the CPU is showing little or no activity.
精彩评论