VMware {code} Community
Jenk
Contributor
Contributor
Jump to solution

c#, Win 2k3 server, Vix 1.6.2, VMWare Server 2 - Won't connect

Hi all,

I'm failing at first hurdle..

My class:

using System;
using System.Collections;
using System.Text;
using VixCOM;

namespace IntegrationTesting
{
	public class IntegrationTest
	{
		VixCOM.VixLib lib = new VixCOM.VixLib();
		VixCOM.IJob job;
		VixCOM.IHost host;
		UInt64 err;
		object results = null;

		public static void Main (String[] args) 
		{
			IntegrationTest instance = new IntegrationTest();
		}

		public IntegrationTest()
		{
			this.Connect();
		}
	
		public void Connect() 
		{
			this.job = this.lib.Connect(VixCOM.Constants.VIX_API_VERSION,
				VixCOM.Constants.VIX_SERVICEPROVIDER_VMWARE_SERVER,
				null,
				0,
				null,
				null,
				0,
				null,
				null);

			this.err = job.Wait(new int[] { VixCOM.Constants.VIX_PROPERTY_JOB_RESULT_HANDLE },
				ref results);

			if (lib.ErrorIndicatesFailure(err)) 
			{
				Console.Out.WriteLine(VixCOM.Constants.VIX_API_VERSION.ToString());
				Console.Out.WriteLine(lib.GetErrorText(err, null));
				Console.Out.WriteLine("Error code: " + err.ToString());
				Console.In.ReadLine();
			} 
			else 
			{
				this.host = (VixCOM.IHost)((object[])results)[0];
			}
		}

		public void FindItems () 
		{
			this.job = this.host.FindItems(VixCOM.Constants.VIX_FIND_REGISTERED_VMS,
				null,
				-1,
				new DiscoveryCallback(lib));
		}
	}
}

The output:

-1

The system returned an error. Communication with the virtual machine may have been interrupted

Error code: 16{/code}

I've tried using

NetSh int ip chimney DISABLED{/quote} but it's still not working.

I can connect to the VMServer via https://:8308/ui just fine.

Anyone have any ideas?

Ps. This text/thread/post editor is absolutely, shockingly hideous Smiley Sad

0 Kudos
1 Solution

Accepted Solutions
fixitchris
Hot Shot
Hot Shot
Jump to solution

You'll need to use VIX_SERVICEPROVIDER_VMWARE_VI_SERVER

Here is my implementation of connect:

Dim m_host As String = "https://172.16.4.242:8333/sdk" '"https://172.16.2.2:8333/sdk" ' need to specify ip NOT DNS

Dim m_port As Integer = 0 'value does not matter when connecting to VMWARE server 2.0

Dim m_user As String = "user" 'must pass user/pass explicitly; current user does not work

Dim m_pass As String = "pass"

m_hostJob = m_lib.Connect(VixCOM.Constants.VIX_API_VERSION, VixCOM.Constants.VIX_SERVICEPROVIDER_VMWARE_VI_SERVER, m_host, m_port, m_user, m_pass, 0, Nothing, Nothing)

View solution in original post

0 Kudos
3 Replies
fixitchris
Hot Shot
Hot Shot
Jump to solution

You'll need to use VIX_SERVICEPROVIDER_VMWARE_VI_SERVER

Here is my implementation of connect:

Dim m_host As String = "https://172.16.4.242:8333/sdk" '"https://172.16.2.2:8333/sdk" ' need to specify ip NOT DNS

Dim m_port As Integer = 0 'value does not matter when connecting to VMWARE server 2.0

Dim m_user As String = "user" 'must pass user/pass explicitly; current user does not work

Dim m_pass As String = "pass"

m_hostJob = m_lib.Connect(VixCOM.Constants.VIX_API_VERSION, VixCOM.Constants.VIX_SERVICEPROVIDER_VMWARE_VI_SERVER, m_host, m_port, m_user, m_pass, 0, Nothing, Nothing)

0 Kudos
Jenk
Contributor
Contributor
Jump to solution

Hi,

I've changed the connect line to this:

this.job = this.lib.Connect(VixCOM.Constants.VIX_API_VERSION,
				VixCOM.Constants.VIX_SERVICEPROVIDER_VMWARE_VI_SERVER,
				"https://127.0.0.1:8308/sdk",
				0,
				"user",
				"pass",
				0,
				null,
				null);

Where user and pass represent a username and password that have permissions, and now I get: "Unable to connect to host"

I also tried 8308, just in case but it had the same issue. It is localhost I am (trying) connecting to.

0 Kudos
Jenk
Contributor
Contributor
Jump to solution

After correcting my typo (1270.0...) I have been able to connect. Many thanks Smiley Happy

0 Kudos