Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#2.0 C#3.0
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 9:23am
Comments
Lloyd Atkinson at 13-Oct-10 15:52pm
   
Does Linux and ESX support WMI?
FernandaUY at 18-Oct-10 13:49pm
   
No, they not. That's why I'm trying to avoid the connection to both systems.
Rate this: bad
good
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. Smile | :)
 
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[^]
  Permalink  
Comments
FernandaUY at 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
Rate this: bad
good
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. Smile | :)

 
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.
  Permalink  
Comments
FernandaUY at 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)

  Print Answers RSS
0 OriginalGriff 240
1 Kamal Rocks 184
2 BillWoodruff 173
3 Sergey Alexandrovich Kryukov 170
4 PIEBALDconsult 160
0 OriginalGriff 5,695
1 DamithSL 4,506
2 Maciej Los 4,007
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,180


Advertise | Privacy | Mobile
Web01 | 2.8.141216.1 | Last Updated 14 Oct 2010
Copyright © CodeProject, 1999-2014
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