1

I use the following method to connect vSphere API with .NET C#. I am able to connect but the constructor for new VimService() takes too much time to be initialized.

I have two questions regarding this?

  1. What can be the possible reason for this latency(servers are in the same network)?
  2. How can I make this initialization faster?

public void Connect(string url, string username, string password) {
     if (_service != null) {
        Disconnect();
     }
     _service = new VimService(); // it takes almost 1 minute to respond
     _service.Url = url;
     _service.Timeout = 600000; 
     _service.CookieContainer = new System.Net.CookieContainer();

     _sic = _service.RetrieveServiceContent(_svcRef);

     if (_sic.sessionManager != null) {
        _service.Login(_sic.sessionManager, username, password, null);
     }

     _state = ConnectionState.Connected;
     if (AfterConnect != null) {
        AfterConnect(this, new ConnectionEventArgs());
     }
  }
Rahul Tripathi
  • 168,305
  • 31
  • 280
  • 331
Jean
  • 524
  • 4
  • 21

0 Answers0