hello, i am using a .NET 1.1 winform to perform webrequests via the System.Net.WebClient class (not a webservice, actually). It uploads values via a POST command & a URL, then receives the html back. nothing too complicated there. except, i am frequently getting the dreaded error: The underlying connection was closed: an unexpected error occurred on a receive ....which after some googling, appears to be a .NET bug w/ regards to open connections actually being closed. this error is typically run into while working w/ ASP.NET webservers and/or webservices. i have found many articles instructing one to disable keep-alives, and using HTTP version 1.0. doing so in this method from the "reference.cs" seems common: protected override WebRequest GetWebRequest(Uri uri) { HttpWebRequest webRequest = (HttpWebRequest) base.GetWebRequest(uri); webRequest.KeepAlive = false; webRequest.ProtocolVersion=HttpVersion.Version10; return webRequest; } ....however, i dont know what this "reference.cs" file is. can anyone provide me w/ the following clues: - how can i have my WebClient object use a custom WebRequest like the above? - can i somehow set the keepalive & http version via the WebClient.Headers collection? - is this bug perhaps fixed in .NET 2.0 ? any help would be appreciated! thanks, matt
The reference.cs file is created via Visual Studios when you add a web reference to a project. This file is automatically generated for you that handles the communication between your reference to a webservice method which is based upon the WSDL (the contract of what the webservice provides to the world). Hope this helps explain the reference.cs file for you.
Don't see what you're looking for? Try a search.
|