我使用以下方法将vSphere API与.NET C#连接。 我能够连接,但新的VimService()的构造函数需要花费太多时间进行初始化。
我对此有两个问题?
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());
}
}