I get the below error while extracting data from vCenter 5.5 Server using C# vSphere 5.5 SDK (The underlying connection was closed: A connection that was expected to be kept alive was closed by the server.)
ERROR The underlying connection was closed: A connection that was expected to be kept alive was closed by the server.
System.Net.WebException: The underlying connection was closed: A connection that was expected to be kept alive was closed by the server. ---> System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host
at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags)
at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
--- End of inner exception stack trace ---
at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
at System.Net.FixedSizeReader.ReadPacket(Byte[] buffer, Int32 offset, Int32 count)
at System.Net.Security._SslStream.StartFrameHeader(Byte[] buffer, Int32 offset, Int32 count, AsyncProtocolRequest asyncRequest)
at System.Net.Security._SslStream.StartReading(Byte[] buffer, Int32 offset, Int32 count, AsyncProtocolRequest asyncRequest)
at System.Net.Security._SslStream.ProcessRead(Byte[] buffer, Int32 offset, Int32 count, AsyncProtocolRequest asyncRequest)
at System.Net.TlsStream.Read(Byte[] buffer, Int32 offset, Int32 size)
at System.Net.PooledStream.Read(Byte[] buffer, Int32 offset, Int32 size)
at System.Net.Connection.SyncRead(HttpWebRequest request, Boolean userRetrievedStream, Boolean probeRead)
--- End of inner exception stack trace ---
at System.Web.Services.Protocols.WebClientProtocol.GetWebResponse(WebRequest request)
at Microsoft.Web.Services3.WebServicesClientProtocol.GetResponse(WebRequest request, IAsyncResult result)
at Microsoft.Web.Services3.WebServicesClientProtocol.GetWebResponse(WebRequest request)
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
at Vim25Api.VimService.RetrieveProperties(ManagedObjectReference _this, PropertyFilterSpec[] specSet)
at vCenterTestConnect.vCenterESXHostInfo.getvCenterHostAdvancedInfo()
at vCenterTestConnect.vCenterESXHostInfo.startExtraction()
Yje application works fine in test environment in our lab (with 2 hosts and 22 VM) but gives the above error when used in prod environment. Any help would be appreciated.
Any inputs for above error would be appreciated.
You didn't put any code???? How are we supposed to troubleshoot errors in your code if you only put the error messge and not your code? I have seen connections close when I first developed my webapp and I noticed that whenever I clicked a button and ran some code against vSphere on the next button click the session would be closed and I would get some errors like you have. Maybe this is a problem with your program scope and vSphere is closing the connection on you. I could be way off, but that is my best guess from my experinces and NO CODE. I would be happy to take a look at what is going on in your code if you would upload some.
Josh