To download the guest file
a. Get url of the file by calling C# SDK InitiateFileTransferToGuest
as mentioned in https://www.vmware.com/support/developer/converter-sdk/conv50_apireference/vim.vm.guest.FileManager.html
b. Used C# SDK to get the file contents
var request = (HttpWebRequest)HttpWebRequest.Create(url);
request.Method = "GET";
using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
{
Stream dataStream = response.GetResponseStream();
StreamReader reader = new StreamReader(dataStream);
fileContent = reader.ReadToEnd();
reader.Close();
dataStream.Close();
}
Error
While calling Http Get on url 'https://10.20.64.173:443/guestFile?id=299&token=5254f16d-d5f6-6222-7645-0e1d32810eb2299', the request gets time out after 100 seconds for each and every VM.
Failed with System.Net.WebException exception and message The operation has timed out.
"StackTrace: at System.Net.HttpWebRequest.GetResponse()
Workaround:
Although I can increase the timeout by setting timeout attribute to something more than default value of 100s.
HttpWebRequest.Timeout Property (System.Net) | Microsoft Docs
Ask is
1. How to make my vcenter server respond within 100seconds.
2. It would be great if anyone could point me out to architecture, of how the file transfer work in vcenter, in o.w. does the file contents are copied to from guest to webserver which seems to be less scalable.