VixCOM + IIS 6.0 + ASP.NET

Oct 5, 2009 at 8:11 PM
Edited Oct 5, 2009 at 8:14 PM

Hi all.


I'm using VixCOM my project. I coded C# my project and i test connecting esx host and control virtual servers in visual studio 2008 deveploment server. Everything is normally in my local deveploment server. When i uploaded project my web site,  i'm trying remote esx host connection but project is not running. I'm trying connecting to esx host, my iis is down and i receive Server Application Error.

I find this problem in web, i'm trying set  permissions but its not work.


Note : VixApi installed in server. And vSphere client installed my server.

        I'm trying desktop app. in server, i receive "Vestris.VMWareLib.VMWareException: The handle is not a valid VIX object" exception. But in my computer everything is normally.

Server : Windows 2003 Enterprise Edition, ASP.NET 2.0,3.0,3.5 Installed, configured.






Oct 6, 2009 at 3:23 AM

Either debug your web process or add a try/catch and get the callstack for this exception. I'll try to help you from there.

Oct 7, 2009 at 3:25 PM
Edited Oct 7, 2009 at 7:22 PM

I tried try catch method but code isnt go catch block.  IIS is lock when creating class (VMWareVirtualHost Srv = new VMWareVirtualHost();)  and send "Server Application Unavailable ".


Oct 8, 2009 at 12:44 PM
Edited Oct 8, 2009 at 12:45 PM

It looks like it won't load the VixCOM COM object (from VixCOM.dll). I've seen things like this happen when, for example, you don't allow 32-bit applications in the application pool in IIS7 on a 64-bit server. But there're other reasons. The 32-bit setting is somewhere in advanced options for the application pool, check it.

Next, I think you should make a step back and try to do this in raw VIX API to figure out what's going on. Make a reference to VixCOM.dll directly and use the VixCOM sample code. Start with something like this.

VixCOM.VixLib vix = new VixLib();
// connect to a VI host
Console.WriteLine("Connecting to VI host");
IJob connectJob = vix.Connect(Constants.VIX_API_VERSION, Constants.VIX_SERVICEPROVIDER_VMWARE_VI_SERVER, "", 0, "vmuser", "admin123", 0, null, null);
object[] connectProperties = { Constants.VIX_PROPERTY_JOB_RESULT_HANDLE };
object hosts = null;
ulong rc = connectJob.Wait(connectProperties, ref hosts);
if (vix.ErrorIndicatesFailure(rc)) throw new Exception(vix.GetErrorText(rc, "en-US"));
IHost host = (IHost)((object[])hosts)[0];

See how far this code goes. I bet it aborts at new VixLib() which loads VixCOM.dll.

Edit: I see you're talking about IIS6, I am not sure whether my story about 64-bit/32-bit applies at all.

Oct 10, 2009 at 8:12 AM


Thanks for replies.

I was updated vix api version and tried your method, i connected esx host desktop applications and visual studio web server. IIS isnt lock now. But IIS is not found/read/execute vixcom dll when i called connection in IIS.

Problem is now, IIS isnt execute dll.



Oct 13, 2009 at 12:26 PM

Can you confirm a few things?

  • You're using IIS6
  • This is an ASP.NET 2.0 application (or 3.5?)
  • The application pool for your application is running integrated or classic mode?
  • The same code works in a command-line program on the same machine.

Again, trap the exception, there's got to be an error code that's better than "it can't load vixcom.dll".

Check the event log, maybe there's an error there?

I really don't know otherwise. The object doesn't load because it either doesn't exist or IIS doesn't have the right permissions for it. I suggest asking whether anyone made it work on the VixCOM forum in the meantime. Maybe this is of relevance: