Dear,
i'm using VMWare.Vim library for .NET application, to inspect my hypervisor. Usually i start a request with Connect() method,querying items and Disconnect(), and all works.
I would like to avoid Connect/Disconnect every time to improve performance but i notes there's no property o method to check if connection is alive (just for example the network fall down).
So I would like to know if is there a suggestion to check connection status or if i must connect/disconnect every time.
Thanks
If you check the SessionManager, the CurrentSession property indicates if a there is a live session.
If you want to avoid doing a Connect-Disconnect each time, you also look at the SaveSession and LoadSession methods.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
If you check the SessionManager, the CurrentSession property indicates if a there is a live session.
If you want to avoid doing a Connect-Disconnect each time, you also look at the SaveSession and LoadSession methods.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thanks for your reply. I'm newbie in vSphere PowerCLI and I'm not able to get access to SessionManager property from VimClientImpl.ServiceContent (see attached file). Where am I wrong (below my connection code)?
VimClient _connectionclient = new VimClientImpl();
string connectionstring = "https://" + _connectionname + "/sdk";
_connectionclient.Connect(connectionstring);
_connectionclient.Login(_username, _password)
The SessionManager in ServiceContent is a MoRef (a Managed Object Reference).
Kind of like a pointer, you will have to use GetView method to get the actual object from the MoRef.
In the vSphere SDK for .NET Developer’s Guide you'll find examples.
Also have a look at the VMware{code} site, they have examples as well.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Many thanks all it's clear now.