Click here to Skip to main content
15,885,278 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi!

I have a web system built in ASP.Net and VB.Net (VS 2010), and the system has Web Service(.asmx). I call functions in web service from a desk top tool built in VB.Net to upload a file to the web site. Some of our clients get System.Net.Sockets.SocketException occasionally even though the web site is up and running and other users have no problem using the desk top tool. I googled about this issue and found that this might be because of a full 'backlog', but I'm not quite sure how to fix this problem on the server side (in web service). Is there any suggestion how to fix this? Theoretically, the desk top tool allows the users to upload any size of file (tested up to 1GB) and it takes for a while to finish uploading. I have not added 'retry' logic to the functions yet as uploading file will take some time and I thought retrying might not help this situation. By the way, I get the exact same exception when I run the desk top tool without having the website running. Thanks in advance.

The function call in the desk top tool is like this. The exception is thrown at the 2nd line.

VB
myService = New ProjectManagement_FileUpload.FileUpload1()
objXML = myService.Get_Login_XML(strUserName, strPassword, strVersion)


The function in web service (.asmx.vb) is like this. (Omitted detailed code.)

VB
<WebMethod()> _
Public Function Get_Login_XML(ByVal strUserName As String, ByVal strPassword As String, ByVal strVersion As String) As XmlDocument
    Dim objXML As XmlDocument
    Dim objXML_Error As XmlDocument
    Dim boolResult As Boolean
    Dim boolValid As Boolean
    Dim strFunctionResult As String

    objXML = Nothing
    objXML_Error = Nothing

    Try
        'Create XML document

        'Check the version

        'Validate Login

        'Get User Information

        strFunctionResult = "~P"

    Catch ex As Exception

        strFunctionResult = "~EGet_Login_XML Error: " & ex.ToString()

    End Try

    If strFunctionResult.StartsWith("~E") AndAlso objXML IsNot Nothing Then
        Set_XML_Element("Error", strFunctionResult.Substring(2), objXML_Error)
        Get_Login_XML = objXML_Error
        Exit Function
    End If

    Get_Login_XML = objXML
End Function


The error message is this.
System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it 127.0.0.1:50897
   at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
   at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Int32 timeout, Exception& exception)
   --- End of inner exception stack trace ---
   at System.Net.HttpWebRequest.GetRequestStream(TransportContext& context)
   at System.Net.HttpWebRequest.GetRequestStream()
   at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
   at ProjectManagement_FileUpload.ProjectManagement_FileUpload.FileUpload1.Get_Login_XML(String strUserName, String strPassword, String strVersion) in C:\Client Projects\Project Management System\ProjectManagement_VBApp\ProjectManagement_UploadFile\ProjectManagement_FileUpload\ProjectManagement_FileUpload\Web References\ProjectManagement_FileUpload\Reference.vb:line 105
   at ProjectManagement_FileUpload.frmLogin.btnLogin_Click(Object sender, EventArgs e) in C:\Client Projects\Project Management System\ProjectManagement_VBApp\ProjectManagement_UploadFile\ProjectManagement_FileUpload\ProjectManagement_FileUpload\frmLogin.vb:line 118
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900