Hello
I'm sort of new to this forum, I think.
I'm attempting to write a C# application to query a version 6.5 esxi host and I am having issues connecting to the host. I found the following code that I'm using on the web but when I access the host it throws the following exception:
"Additional information: Could not establish trust relationship for the SSL/TLS secure channel with authority 'esxi host'.
I am using the following code:
{
/tslServiceContent sc = vmClient.Connect("https://"+hostip+"/sdk");
UserSession us = vmClient.Login(username, Password);
IList<VMware.Vim.EntityViewBase> vms = vmClient.FindEntityViews(typeof(VMware.Vim.VirtualMachine), null, null, null);
foreach (VMware.Vim.EntityViewBase tmp in vms)
{
VMware.Vim.VirtualMachine vm = (VMware.Vim.VirtualMachine)tmp;
Console.WriteLine((bool)(vm.Guest.GuestState.Equals("running") ? true : false));
Console.WriteLine((string)vm.Client.ServiceUrl);
Console.WriteLine(vm.Guest.HostName != null ? (string)vm.Guest.HostName : "");
Console.WriteLine("----------------");
}
}
I'm not sure where to look for the issue on this. I have searched for the ssl/tsl issues but could not find any solution.
I have PowerCLI, VMware-PowerCLI-6.5.0-4624819, installed and I'm using the vmware.vim.dll that came with it.
I am also using VS2015 to code the application using C#.
The hosts are at version 6.5.0 (Build 5310538).
Any help would be appreciated.
Thanks
Reaz