Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Web Services / December 2007

Tip: Looking for answers? Try searching our database.

Exception: The underlying connection was closed

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Talal Sultan - 07 Dec 2007 14:23 GMT
Hi all,

I'm using WSE 3.0 in my project to connect a web application to a web
service. I'm using username token for WSE. In some pages where I have upload
file controls I get an exception saying :

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

I have searched online and found that this problem is a well known bug in
.NET 1.1 and I also found a way to solve it by modifying some code in the
reference.cs file of the web service proxy in the web application. However I
didn't manage to find a reference to the problem in .NET 2.0. Is there a way
to access the reference.cs file in a web application developped with .NET
2.0? If not, how can I fix this problem?

I have also tried to turn off the keep-alive option of the website from the
IIS console but that resulted in other behavioral problems. I'm using
Windows Server 2003 with IIS 6.

Ultimately, if there is no way to fix this, can someone direct me towards a
file upload control that I could use that might fix this problem? I am
wondering if this problem is related to another problem I am having: when
uploading files (one or multiple file upload controls on same page) a
timeout occurs where IE shows that it is still waiting for a reply from the
server and nothing happens. If I check the server, I notice that it has
finished processing the request and the database has been populated with the
results but nothing goes back to the IE client.

Thanks for your help,
Talal
Phil Lee - 07 Dec 2007 17:36 GMT
Talal,

I did this for a similar problem:

public class MyWseProxy : GeneratedWseProxy
{
   protected override GetWebRequest(Uri uri)
   {
               HttpWebRequest httpRequest = request as HttpWebRequest;

               if (null != httpRequest)
               {
                   httpRequest.KeepAlive = false;
               }
   }
}

You could probably do:

public partial GenerateWseProxy
{
   .. as above
}

Regards
Phil Lee

> Hi all,
>
[quoted text clipped - 27 lines]
> Thanks for your help,
> Talal
Talal Sultan - 10 Dec 2007 09:18 GMT
Hi Phil,

Thanks for the tip. I have implemented your solution with a few
modifications:

The code you have sent does not compile, I replaced it with the following:

public class MyServiceWse : ServiceWse

{

protected override System.Net.WebRequest GetWebRequest(Uri uri)

{

HttpWebRequest webRequest = (HttpWebRequest)base.GetWebRequest(uri);

webRequest.KeepAlive = false;

webRequest.ProtocolVersion = HttpVersion.Version10;

return webRequest;

}

}

Also, the second method you suggested (with the partial class) did not work
either.

Now everything compiles well and I have tested it locally, the "new" web
service proxy works just fine. I still need to publish the solution to the
testing server, that's where I was getting the connection problems. I'll let
you know how it goes.

Thanks again,
Talal

> Talal,
>
[quoted text clipped - 54 lines]
>> Thanks for your help,
>> Talal
Phil Lee - 10 Dec 2007 10:21 GMT
Talal,

I'm glad to hear it worked.  I was just about to post some modified code.  I
realized I missed out 'WebRequest request=base.GetWebRequest(uri)'/

Phil
> Hi Phil,
>
[quoted text clipped - 92 lines]
>>> Thanks for your help,
>>> Talal
Talal Sultan - 11 Dec 2007 17:42 GMT
Phil, sorry to bother you again, I am still getting this error (in the
subject line.)
At first we thought it was solved but then the page kept on hanging with no
response. That was the exact behavior I got when I unchecked the keep-alive
from IIS.

So I tried setting the http protocol to 1.0 without putting to false the
keep-alive. Still I had the same hang behavior.

I thought the problem was with the upload itself, so we have downloaded the
trial version of Telerik RAD controls. The upload works fine but then
suddenly we have the connection closed thing again.

Could it be possible that the problem comes from WSE? It is really weird. I
have set the Timeout property of the wse proxy to a high value, but still
same error.

Any ideas? I really appreciate the help :)

Thanks,
Talal

> Talal,
>
[quoted text clipped - 54 lines]
>> Thanks for your help,
>> Talal
Phil Lee - 13 Dec 2007 09:20 GMT
Talal,

I don't think I can help.  I know we used to get that error intermittently,
but we don't use file upload.

Phil

> Phil, sorry to bother you again, I am still getting this error (in the
> subject line.)
[quoted text clipped - 76 lines]
>>> Thanks for your help,
>>> Talal

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.