VMware Cloud Community
ReazBaksh
Contributor
Contributor

vmware.vim ssl/tsl issue

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

Reply
0 Kudos
1 Reply
Zoltan86
Contributor
Contributor

Hi,

is this already solved?

The "https://..../sdk" is not working anymore, because vim is not a web service, for more details, check this article:

VMware Knowledge Base

So the right form: "https://example.mycompany.com:443"

If I've right, when you open your ESXi host via web browser, you will see an error like this:

pastedImage_1.png

I can't solve this issue, but if I have solution, I will inform you.

Reply
0 Kudos