Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Services > HttpWebRequest.KeepAlive setting and web exception ‘RequestCancele

Reply
Thread Tools

HttpWebRequest.KeepAlive setting and web exception ‘RequestCancele

 
 
TBATravel
Guest
Posts: n/a
 
      08-17-2007
Hi,

Ours is an ASP.NET 2.0 web application interacting with a third-party web
service hosted on Tomcat servers.

When client application submits the web request to the web service from the
Production servers, we observe the frequent occurrence of the error 'The
request was aborted: The request was canceled. at
System.Net.HttpWebRequest.GetResponse()'.
The status of the web exception received is ‘RequestCanceled’, which is the
default status.

In these cases, it is observed that no request from the ASP.NET client is
hitting the Tomcat servers and the time at which the error is getting logged
is almost instantaneous after submitting the request. So, it looks like the
connection to the server is not available when the client application expects
it to be open.

This issue is affecting our existing customers to a greater extent.
Can you please let us know the cause for this issue and the solution for the
same?

Note : From the information available, we understand that one possible
solution for this issue is - setting ‘HttpWebRequest.KeepAlive = false’. But
we also understand that this would slow down the process by opening a new
connection for each request. Hence we are hesitant to follow this approach,
as our application is live and several customers are currently using it.
Obviously we do not want to slow down the response times.
Can you please let us know whether setting this ‘KeepAlive’ to ‘false’ be
advisable and the impact of the same?
---
Thanks,
Priya
 
Reply With Quote
 
 
 
 
John Saunders [MVP]
Guest
Posts: n/a
 
      08-17-2007

"TBATravel" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi,
>
> Ours is an ASP.NET 2.0 web application interacting with a third-party web
> service hosted on Tomcat servers.
>
> When client application submits the web request to the web service from
> the
> Production servers, we observe the frequent occurrence of the error 'The
> request was aborted: The request was canceled. at
> System.Net.HttpWebRequest.GetResponse()'.
> The status of the web exception received is ‘RequestCanceled’, which is
> the
> default status.
>
> In these cases, it is observed that no request from the ASP.NET client is
> hitting the Tomcat servers and the time at which the error is getting
> logged
> is almost instantaneous after submitting the request. So, it looks like
> the
> connection to the server is not available when the client application
> expects
> it to be open.


No, it looks like the Tomcat side sees no packets from your client, and like
your client is failing to communicate with the Tomcat side. Don't assume
that the connection is unavailable. In fact, don't assume anything yet.

I suggest you take a look at the network traffic between the client and the
server when the problem occurs. You can start with doing a "tracert" command
from a Command Prompt window ON THE CLIENT MACHINE as soon as the problem
occurs. Use "tracert -d <<servername>>" (the "-d" displays the output as
numeric, without depending on a DNS server to translate it into a host
name). tracert may give you some idea about your general connectivity at
that time.

Similarly, try "ping <<servername>>". See if you can get there. If you can,
great, but if you can't, it's not proof - there could be a firewall or
something else preventing the ping request from reaching the server or
preventing the server from responding.

Another trick is to use the old "telnet" command from the Command Prompt
window. Use:

-----------------------------------
C:> telnet <<servername>> 80
GET /
-----------------------------------

You may not have known this, but HTTP is based on the same protocol as the
old remote terminal protocol, "telnet". If you telnet to the port your
server is meant to be listening on, you can manually send a simple HTTP
request. If you can't connect with telnet, then your client won't be able to
connect, either. If you _can_ connect, but get an error message when you do
a "GET /" or "GET /servicepath/servicename.asmx", then your client would
likely get the same error.

You may try looking at the traffic from the client. I suggest you do so from
a point on the same network segment as the client, and in fact a location
physically close to the client. Look to see what, if any, traffic comes from
the client when the problem occurs. In particular, if there are any
responses at all to the messages from the client, then it tells you that you
have connectivity to whatever responded.
--
John Saunders [MVP]


 
Reply With Quote
 
 
 
 
Jp
Guest
Posts: n/a
 
      08-21-2007
Hi John,

Thanks for the response.

As this issue of ‘Request aborted. Request Canceled’ occurs only in the
Production environment, there are some practical difficulties (due to the
restricted access) in carrying out the exercise you have suggested.
There are multiple servers on which the application is hosted and so it is
not possible to monitor the logs in all the servers continuously and track
them.

Moreover, from the analysis done with the available logs, we can observe
that there are some successful responses almost immediately after the error
‘Request aborted’ have been logged on the same server.

Let us consider the case below:
- In one of the servers, at TimeStamp 05:30:19 - First request got logged.
- Immediately at the same time 05:30:19 - 'The request was aborted: The
request was canceled. at System.Net.HttpWebRequest.GetResponse()' error got
logged.
- The second request got logged at 05:30:20.
- Proper response for the second request got logged at 05:30:24.
In this case, as it is evident the request at 05:30:19 got aborted and the
request at 05:30:20 worked fine. So, as you would agree it is practically not
possible to try the ‘tracert’, ‘ping’ or ‘telnet’ within one second.

Please let us know the further possible suggestions / fix for this issue.

We feel that identifying the exact root cause of this issue and fixing it
may not be immediate.
In the meanwhile, we would like to follow the approach
‘HttpWebRequest.KeepAlive = false’ as our live customers are severely
impacted by this issue.
Can you please let us know whether setting this ‘KeepAlive’ to ‘false’ be
advisable and the impact of the same?

Thanks,
Jp

"John Saunders [MVP]" wrote:

>
> "TBATravel" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > Hi,
> >
> > Ours is an ASP.NET 2.0 web application interacting with a third-party web
> > service hosted on Tomcat servers.
> >
> > When client application submits the web request to the web service from
> > the
> > Production servers, we observe the frequent occurrence of the error 'The
> > request was aborted: The request was canceled. at
> > System.Net.HttpWebRequest.GetResponse()'.
> > The status of the web exception received is ‘RequestCanceled’, which is
> > the
> > default status.
> >
> > In these cases, it is observed that no request from the ASP.NET client is
> > hitting the Tomcat servers and the time at which the error is getting
> > logged
> > is almost instantaneous after submitting the request. So, it looks like
> > the
> > connection to the server is not available when the client application
> > expects
> > it to be open.

>
> No, it looks like the Tomcat side sees no packets from your client, and like
> your client is failing to communicate with the Tomcat side. Don't assume
> that the connection is unavailable. In fact, don't assume anything yet.
>
> I suggest you take a look at the network traffic between the client and the
> server when the problem occurs. You can start with doing a "tracert" command
> from a Command Prompt window ON THE CLIENT MACHINE as soon as the problem
> occurs. Use "tracert -d <<servername>>" (the "-d" displays the output as
> numeric, without depending on a DNS server to translate it into a host
> name). tracert may give you some idea about your general connectivity at
> that time.
>
> Similarly, try "ping <<servername>>". See if you can get there. If you can,
> great, but if you can't, it's not proof - there could be a firewall or
> something else preventing the ping request from reaching the server or
> preventing the server from responding.
>
> Another trick is to use the old "telnet" command from the Command Prompt
> window. Use:
>
> -----------------------------------
> C:> telnet <<servername>> 80
> GET /
> -----------------------------------
>
> You may not have known this, but HTTP is based on the same protocol as the
> old remote terminal protocol, "telnet". If you telnet to the port your
> server is meant to be listening on, you can manually send a simple HTTP
> request. If you can't connect with telnet, then your client won't be able to
> connect, either. If you _can_ connect, but get an error message when you do
> a "GET /" or "GET /servicepath/servicename.asmx", then your client would
> likely get the same error.
>
> You may try looking at the traffic from the client. I suggest you do so from
> a point on the same network segment as the client, and in fact a location
> physically close to the client. Look to see what, if any, traffic comes from
> the client when the problem occurs. In particular, if there are any
> responses at all to the messages from the client, then it tells you that you
> have connectivity to whatever responded.
> --
> John Saunders [MVP]
>
>
>

 
Reply With Quote
 
John Saunders [MVP]
Guest
Posts: n/a
 
      08-21-2007
"Jp" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi John,
>
> Thanks for the response.
>
> As this issue of ‘Request aborted. Request Canceled’ occurs only in the
> Production environment, there are some practical difficulties (due to the
> restricted access) in carrying out the exercise you have suggested.
> There are multiple servers on which the application is hosted and so it is
> not possible to monitor the logs in all the servers continuously and track
> them.
>
> Moreover, from the analysis done with the available logs, we can observe
> that there are some successful responses almost immediately after the
> error
> ‘Request aborted’ have been logged on the same server.
>
> Let us consider the case below:
> - In one of the servers, at TimeStamp 05:30:19 - First request got logged.
> - Immediately at the same time 05:30:19 - 'The request was aborted: The
> request was canceled. at System.Net.HttpWebRequest.GetResponse()' error
> got
> logged.
> - The second request got logged at 05:30:20.
> - Proper response for the second request got logged at 05:30:24.
> In this case, as it is evident the request at 05:30:19 got aborted and the
> request at 05:30:20 worked fine. So, as you would agree it is practically
> not
> possible to try the ‘tracert’, ‘ping’ or ‘telnet’ within one second.
>
> Please let us know the further possible suggestions / fix for this issue.
>
> We feel that identifying the exact root cause of this issue and fixing it
> may not be immediate.
> In the meanwhile, we would like to follow the approach
> ‘HttpWebRequest.KeepAlive = false’ as our live customers are severely
> impacted by this issue.
> Can you please let us know whether setting this ‘KeepAlive’ to ‘false’ be
> advisable and the impact of the same?


I haven't used this feature myself, so I can't say. The effect of setting it
to false should be that the connection between client and server will be
closed after each request/response pair. There will be the added overhead of
a new connection being established and torn down for each request.
--
John Saunders [MVP]

 
Reply With Quote
 
Jp
Guest
Posts: n/a
 
      08-24-2007
Hi John,

Thanks for your response.

Regards,
Jp


> I haven't used this feature myself, so I can't say. The effect of setting it
> to false should be that the connection between client and server will be
> closed after each request/response pair. There will be the added overhead of
> a new connection being established and torn down for each request.
> --
> John Saunders [MVP]
>
>

 
Reply With Quote
 
TBATravel
Guest
Posts: n/a
 
      08-24-2007
Microsoft experts could provide some help/guidance?
--
Thanks,
Priya


"Jp" wrote:

> Hi John,
>
> Thanks for your response.
>
> Regards,
> Jp
>
>
> > I haven't used this feature myself, so I can't say. The effect of setting it
> > to false should be that the connection between client and server will be
> > closed after each request/response pair. There will be the added overhead of
> > a new connection being established and torn down for each request.
> > --
> > John Saunders [MVP]
> >
> >

 
Reply With Quote
 
WSS
Guest
Posts: n/a
 
      10-10-2007
Priya,

my project is also facing the similar problem in the weblogic server (where
the web service being consumed from .net is hosted), however when using the
tomcat server u can raise the keepalive interval higher than that of web
server you are using. this will keep the connection open so that u can
communicate with simultaneous requests.

go to the post made by Mark in the thread

https://forums.microsoft.com/MSDN/Sh...28977&SiteID=1



"TBATravel" wrote:

> Microsoft experts could provide some help/guidance?
> --
> Thanks,
> Priya
>
>
> "Jp" wrote:
>
> > Hi John,
> >
> > Thanks for your response.
> >
> > Regards,
> > Jp
> >
> >
> > > I haven't used this feature myself, so I can't say. The effect of setting it
> > > to false should be that the connection between client and server will be
> > > closed after each request/response pair. There will be the added overhead of
> > > a new connection being established and torn down for each request.
> > > --
> > > John Saunders [MVP]
> > >
> > >

 
Reply With Quote
 
TBATravel
Guest
Posts: n/a
 
      10-10-2007
Thanks for your help...
we are in the process of doing same and hope this will work as you said
--
Thanks,
Priya


"WSS" wrote:

> Priya,
>
> my project is also facing the similar problem in the weblogic server (where
> the web service being consumed from .net is hosted), however when using the
> tomcat server u can raise the keepalive interval higher than that of web
> server you are using. this will keep the connection open so that u can
> communicate with simultaneous requests.
>
> go to the post made by Mark in the thread
>
> https://forums.microsoft.com/MSDN/Sh...28977&SiteID=1
>
>
>
> "TBATravel" wrote:
>
> > Microsoft experts could provide some help/guidance?
> > --
> > Thanks,
> > Priya
> >
> >
> > "Jp" wrote:
> >
> > > Hi John,
> > >
> > > Thanks for your response.
> > >
> > > Regards,
> > > Jp
> > >
> > >
> > > > I haven't used this feature myself, so I can't say. The effect of setting it
> > > > to false should be that the connection between client and server will be
> > > > closed after each request/response pair. There will be the added overhead of
> > > > a new connection being established and torn down for each request.
> > > > --
> > > > John Saunders [MVP]
> > > >
> > > >

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Handle C++ exception and structured exception together George2 C++ 15 01-29-2008 07:34 AM
Is an exception specification needed if the method throws and catchesits own exception? elcapitan666@gmail.com C++ 2 11-27-2007 04:01 AM
Exception of type 'System.Web.HttpUnhandledException' wasthrown.Exception has been thrown by the target of an invocation.System.WebSystem.Exception jobs ASP .Net 1 11-16-2007 05:57 PM
while executing my client program i get the exception javax.naming.LinkException: [Root exception is javax.naming.LinkException: [Root exception is javax.naming.NameNotFoundException: remaining if plz anybody know how to solve this problem then mahesh Java 0 03-08-2007 12:26 PM
how to show C line number AND exception type in JNI exception stacktrace? Elaine Cheong Java 1 12-09-2006 08:59 AM



Advertisments