VMware Cloud Community
jason_davis
Enthusiast
Enthusiast

Problem connecting to VM from custom application - the console has been disconnected

I have built a web application which relies on PowerCLI .NET API (VMware.VimAutomation).

I have a feature which allows my users to connect to various virtual machines in the system.

I use the following code to get a session ticket and server GUID

            ManagedObjectReference mor = _vimClient.ServiceContent.SessionManager;

            SessionManager session = (SessionManager)_vimClient.GetView(mor, null);

            sessionTicket = session.AcquireCloneTicket();       // used to get a session ticket

            serverGUID = _vimClient.ServiceContent.About.InstanceUuid;   // used to get serverGUID

Then I construct the url such as the following

https://vcenter.ssilab.local:9443/vsphere-client/webconsole.html?vmId=vm-4377&vmName=MY_Machine_Name...

Before the VM is opened, I am directed to vSphere single sign on page.  After inputting my credentials, I see the error message:

The console has been disconnected.  Close this window and re-launch the console to reconnect.

The only workaround I can find is to first login to vSphere from my web browser.  And then run my custom web application.  This obviously is not an acceptable approach for my customer.

I am using vSphere version 6.7

If any advice how to solve this problem, please let me know

Tags (2)
Reply
0 Kudos
0 Replies