"Underlying connection was closed" error on windows service but only occurs when a us

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Gx3r0
    New Member
    • Oct 2009
    • 1

    "Underlying connection was closed" error on windows service but only occurs when a us

    0I have a windows service I created that checks for data to post to an off site webservice over SSL. The service checks every 10 seconds for data to send, if there is data it opens a connection to the remote webservice, and closes the connection after 120 seconds (still checking for data to send during this time). The service works fine if a user is RDP'd into the server, but as soon as no one is logged on and the service attempts to push data, I receive the following error:
    "The underlying connection was closed: An unexpected error occurred on a send."

    I have tried running the service as a local service, network service, under my login, and under a service account, but nothing seems to work. Does anyone have any ideas on what may be causing this?

    Here is the code in my Reference.vb - lines were added as I found possible other solutions in the forums. I am running VB .Net 3.5, developed in VS 2008 Team System. The PC it is running on is a windows 2003 server (virtualized - vmware)
    Code:
    Protected Overrides Function GetWebRequest(ByVal Uri As Uri) As System.Net.WebRequest
                Dim oWebrequest As System.Net.HttpWebRequest = MyBase.GetWebRequest(Uri)
    
                oWebrequest.KeepAlive = False
                oWebrequest.ConnectionGroupName = Guid.NewGuid.ToString
                oWebrequest.ProtocolVersion = System.Net.HttpVersion.Version10
                System.Net.ServicePointManager.Expect100Continue = False
                System.Net.ServicePointManager.MaxServicePointIdleTime = 120000
                Return (oWebrequest)
    End Function
    Last edited by Frinavale; Oct 7 '09, 01:24 PM. Reason: Please post code in [code] ... [/code] tags. Added code tags.
  • Plater
    Recognized Expert Expert
    • Apr 2007
    • 7872

    #2
    have you tried using the newer Version11 instead of Version10 ?

    Comment

    Working...