Click here to Skip to main content
13,139,254 members (91,138 online)
Rate this:
Please Sign up or sign in to vote.
See more:
Hi. I'm collecting information of the servers in my company through WMI.

Most servers are Windows based, but when the server is Linux, or VMWare ESX, the timeout for the ocnnection is almos 3 minutes.

I've tried to change the timeout of the connection as follows:

ConnectionOptions coOpciones = new ConnectionOptions();
coOpciones.Timeout = new TimeSpan(0,0,0,5);

But still continues to spend all the 3 minutes before return the control to the form.

Any suggestions?

Thanks in advance.
Posted 13-Oct-10 8:23am
Lloyd Atkinson 13-Oct-10 15:52pm
Does Linux and ESX support WMI?
FernandaUY 18-Oct-10 13:49pm
No, they not. That's why I'm trying to avoid the connection to both systems.
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

This is strange, Because what you have specified is Connection Timeout. That means it gets connected, but when it tries to perform an operation, it gets timeout. so try setting Operation Timeout.

This should be the case with VMWare thing, otherwise no way you can connect to the Linux box with WMI. :)


 // the namespace we are searching in
ManagementScope Scope = new ManagementScope(@"\.\root\cimv2");
// the query we are performing
WqlObjectQuery Query= new WqlObjectQuery("SELECT * FROM meta_class");
// enumeration options to use for the search; set a time-out value
EnumerationOptions Options = new EnumerationOptions();
Options.Timeout = new TimeSpan(0, 0, 10);
// instantiate the searcher object using the scope and query
ManagementObjectSearcher Searcher = new ManagementObjectSearcher(Scope, Query, Options);

You can get more details about the operation timeout, here[^]
FernandaUY 14-Oct-10 10:41am
Thank for your reply Dave. Saddly, it didn't work. I'm making a PING to the server prior run the query (to avoid quering an OFF server). But, in ESX cases (Linux also), the PING returns SUCCESS, so when I try the WMI query (in a try/catch block), it still spending the whole 3 minutes.
Thnak you again.
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

Yes, That Ping before connect is very nice idea. I think the WMI calls should timeout within 20 sec, 3 min is too long. Are you using any Web/WCF service to do this ? because 3 min is default receive time out value for WCF Service.

Also there are many people on the net trying to fix these problem, with no luck. :-)

so lets try to think the other way,

create a thread to call the server and then start your own timer object and when it expire, kill the thread. also create separate thread for each request, so your app will get the result faster than before. might be parallel processing can finish 10+ servers within 30 sec.
FernandaUY 14-Oct-10 12:30pm
Thanks again Rutvik. No, I'm not using any service, because I'm collecting the information inside our Intranet, so I have no need to create services for this.
The Thread solution is a great idea. I will implement it and let you know.
Best regards.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web02 | 2.8.170915.1 | Last Updated 14 Oct 2010
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100