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 / .NET Framework / CLR / March 2006

Tip: Looking for answers? Try searching our database.

Unexpected behavior - getting exception - Underlying connection cl

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Rahul Anand - 28 Mar 2006 06:09 GMT
As per our requirements we have a web service which internally connects
(Simple HTTP Post Request) to a remote server to initiate some work. We are
calling the web service method asynchronously from a .NET Web Application
hosted on IIS. In our setup the web request form a client can be running for
long duration (may be more than 4 hours).

We are getting exceptions during the HTTP send/receive inside the web
service method. The exception are coming only during high load (for instance
when the pending web request count exceeds 45). For each web request the web
service internally do 10 iterations of Http send/receive (each iteration uses
a new Http connection). There is no fixed pattern in the type of exception
raised.

Following exceptions are coming:

1. The underlying connection was closed: An unexpected error occurred on a
receive
   Status of Web Exception: ReceiveFailure
2. The underlying connection was closed: An unexpected error occurred on a
send
   Status of Web Exception: SendFailure
3. The underlying connection was closed: Unable to connect to the remote
server
   Status of Web Exception: ConnectFailure
4. The underlying connection was closed: The request was canceled
   Status of Web Exception: RequestCanceled

I am using .NET Framework 1.1
Web Service and web application both are written in .NET and hosted on
Win2003. I had tested replacing web application with windows application but
got no improvement.
I have also observed that number RequestCancled exception has decreased once
we moved our web service form Win2000 Server to Win2003 Server.

I have tried the .NET bug fix by setting *keepalive* to false but still
getting exceptions.

I had modified the .NET config timeout settings to higher values.

<CODE>

HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create("URL");
webRequest.KeepAlive = false;
webRequest.ProtocolVersion=HttpVersion.Version10;
webRequest.Timeout = timeOut;
webRequest.Proxy = GlobalProxySelection.GetEmptyWebProxy();
webRequest.Method = "POST";
webRequest.ContentType="application/x-www-form-urlencoded";
StreamWriter myWriter = new StreamWriter(webRequest.GetRequestStream());
myWriter.Write("some post Data");
myWriter.Close();
WebResponse httpWebRes = httpWebRequest.GetResponse();
// Do some work with httpWebRes
httpWebRes.Close();

</CODE>

Thanks in advance.

--
Cheers,
Rahul Anand
q - 28 Mar 2006 06:14 GMT
"some post Data" isn't a valid SOAP message.  Web services communicate
with SOAP messages.  You send it proper XML and you will (possibly) get
proper XML back.

Here are samples of what you have to send and what may be returned:
 http://terraserver-usa.com/TerraService.asmx?op=GetPlaceList
Rahul Anand - 28 Mar 2006 07:22 GMT
> "some post Data" isn't a valid SOAP message.  Web services communicate
> with SOAP messages.  You send it proper XML and you will (possibly) get
> proper XML back.
>
> Here are samples of what you have to send and what may be returned:
>   http://terraserver-usa.com/TerraService.asmx?op=GetPlaceList

The Web Service is working fine and we are getting correct output. The
exceptions are coming during the communication with some other remote server
in our web method.
I think the problem is not directly related to web service. I suspect some
problem in network comminucation may be during heavy load the network
resources are not available or something.

--
Cheers,
Rahul Anand
agapeton@gmail.com - 28 Mar 2006 14:49 GMT
I think you mean to say "service" then... this is not a web service if
it's not dependent on XML messages (by definition, a web service uses
SOAP XML messages and interop with other web service platforms).  I
think you want to be asking about how to deal with exceptions from
HttpWebRequest (which has nothing to do with web services).

Rate this thread:







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.