Click here to Skip to main content
15,891,473 members
Please Sign up or sign in to vote.
5.00/5 (1 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
Comments
LloydA111 13-Oct-10 15:52pm    
Does Linux and ESX support WMI?
FernandoUY 18-Oct-10 13:49pm    
No, they not. That's why I'm trying to avoid the connection to both systems.

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. :)

i.e.

 // 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[^]
 
Share this answer
 
Comments
FernandoUY 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.
Fernanda
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.
 
Share this answer
 
Comments
FernandoUY 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.
Fernanda

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900