CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 3 of 3 FirstFirst 123
Results 31 to 32 of 32
  1. #31
    Join Date
    Sep 2011
    Posts
    69

    Re: The underlying connection was closed: An unexpected error occurred on a receive.

    Okay I think I might have a solution. A while ago I Google my issue and I needed to add this code to my References.cs. Do you know where that file is located at?

    Code:
    protected override WebRequest GetWebRequest(Uri uri)
            {
                HttpWebRequest webRequest = (HttpWebRequest) base.GetWebRequest(uri);
    
                webRequest.KeepAlive = false;
                webRequest.ProtocolVersion=HttpVersion.Version10;
                return webRequest;
            }
    Heres a link that talks about it: http://geekswithblogs.net/denis/arch.../16/50365.aspx

  2. #32
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: The underlying connection was closed: An unexpected error occurred on a receive.

    Quote Originally Posted by kytro360 View Post
    Okay I think I might have a solution. A while ago I Google my issue and I needed to add this code to my References.cs. Do you know where that file is located at?
    If you don't have a web service proxy, then you won't have a references.cs file.

    You don't need to add this method, all you need to do is set up the HttpWebRequest properties the same when you create the object.

    Btw, even though you aren't using a web service proxy so this doesn't apply in your case... in general, modifying the auto-generated proxy code is usually a bad idea (because every time you regenerate the code, you'll need to add back in the changes).

Page 3 of 3 FirstFirst 123

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured