Hi , guys.I'm a newbie about VM.
I work with Vestris.VMWareLib1.4 in VS.Net2008.
I want to make a windows form app to control VMWare Workstation7.0 and VMWare Server2.0. The workstation has been installed in localhost and the Server in the other computer(192.168.0.53) on which WinXP OS runs. In my codes, I use ListBox control to list the workstation's name and the server's name. When user selects one item in the listbox, the app will automaticly connect to the according host. Some code:
VMWareVirtualHost host=new VMWareVirtualHost();
switch (vm_product_type)
{
case (int)(VMPRODUCTTYPE.Server2):
#region server2.0
string connStr = null;
if (consolePort != null && consolePort.Length > 0)
{
connStr = hostIP + ":" + consolePort;
}
else
{
connStr = hostIP+ ":8333";
}
host.ConnectToVMWareVIServer(connStr, account, password, 10);
#endregion
break;
case (int)(VMPRODUCTTYPE.WorkStation):
host.ConnectToVMWareWorkstation(10);
break;
default:
breakl;
}
:Everytime when user select the other item in the listbox ,I have called host. Disconnect() for the previous select and disposed the previous host object.
Problems:
(1)After the app starts, when user select the Workstation item ,the app will connect to workstation sucessfully.But after that, when user click the server item,An exception is thrown:
System.Runtime.InteropServices.COMException (0x80010105): The server threw an exception. (Exception from HRESULT: 0x80010105 (RPC_E_SERVERFAULT))
at Interop.VixCOM.VixLibClass.Connect(Int32 apiVersion,Int32 hostType,String hostName,Int32 hostPort,String userName,String password,Int32 options,IVixHandle propertyList,ICallback jobDoneCallback)
at Vestris.VMWareLib.VMWareVirtualHost.Connect(ServiceProviderType serviceProviderType,String hostName,Int32 hostPort,String username,String password,Int32 timeout)
at Vestris.VMWareLib.VMWareVirtualHost.ConnectToVMWareVIServer(Uri hostUri,String user)name,String password,Int32 timeoutInSeconds
...........................
(2)After the app starts,if user click Server item,the app will automaticly connect to the Server sucessfully.But after that,if user click the Workstation item,the app will throw an exception :
The procedure entry point gvmoni_session_set_useragent could not be located in the dynamic link library gvmoni.dll.
so Coulde anyone help me? I have struggled with it for nearly one week.
Any help will be appreciated. Thanks in advance.
my email: 424wrl@163.com