Reputation: 2619
The following code is used for connecting to a remote (WMI) Object using system.management.ManagementScope (C#).
mgmtScope = new ManagementScope("\\\\" + strHostAddress + "\\" + WMIConnection.dictWMINamespace[nameSpace] + "", connOptions);
string WMITimeOut = ConfigurationManager.AppSettings["WMIConnectionTimeout"];
TimeSpan wmiTimeOutts;
int value;
if (int.TryParse(WMITimeOut, out value))
{
wmiTimeOutts = new TimeSpan(0, 0, value);
}
else
{
wmiTimeOutts = new TimeSpan(0, 0, 60);
}
mgmtScope.Options.Timeout = wmiTimeOutts;
mgmtScope.Connect();
Recently I have added code for timeout. Now I want to do some actions when a request timeout occurs.
Not sure how to find out whether the request has been timed out or not. Any help on this would be greatly appreciated.
Regards Sebastian
Upvotes: 0
Views: 1012