472,977 Members | 1,759 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,977 software developers and data experts.

Webmethod is sometimes executed twice after one request

Hi,

I have hosted my webservice at a hosting company and it has been working
fine for 2 years now. The webservice is called by winforms clients over the
internet, using the proxy class generated by visual studio.

What I do not understand, however, is that sometimes (say 1% of all calls)
are being executed twice on the server side. I notice that because each call
makes an entry in the database. This problem has been around as long as the
webservice exists.

I am sure the webservice is not called twice in the code of the winforms
client. The calling code is very staightforward.

It is important that the webmethods are not executed more than once after
one request, because there are some costs involved for the users of the
application.
Has someone seen this before? Does anyone have a hunch what might be causing
this? Configuration of the webservice, proxy class, IIS etc? Or is it
normal?

Thanks for any ideas.

Ed
Aug 31 '06 #1
3 5509
"Ed Sonneveld" <es********@sunbase.nlwrote in message
news:44**********************@news.xs4all.nl...
Hi,

I have hosted my webservice at a hosting company and it has been working
fine for 2 years now. The webservice is called by winforms clients over
the internet, using the proxy class generated by visual studio.

What I do not understand, however, is that sometimes (say 1% of all calls)
are being executed twice on the server side. I notice that because each
call makes an entry in the database. This problem has been around as long
as the webservice exists.

I am sure the webservice is not called twice in the code of the winforms
client. The calling code is very staightforward.

It is important that the webmethods are not executed more than once after
one request, because there are some costs involved for the users of the
application.
Has someone seen this before? Does anyone have a hunch what might be
causing this? Configuration of the webservice, proxy class, IIS etc? Or is
it normal?
I don't see how this can happen without the client side actually issuing the
call twice. By "client side", I don't just mean the WinForms code, I'm
including any client-side network infrastructure, like proxies, etc. Perhaps
there's some sort of "smart proxy" which is outsmarting itself? I'd look at
a number of things:

1) Are the clients all running the same software and the same version of the
software?
2) Are the clients all behind the same network infrastructure, or are some
at different sites or different companies?
3) Is there any correlation between any subset of clients and the duplicate
messages, or is duplication evenly distributed across all clients? For
instance, maybe it's only the clients at one site which are having this
problem.
4) Network-wise, on a given connection, TCP/IP is meant to prevent the same
bytes being delivered twice. You say you're seeing a web service operation
called twice (ever more than twice, BTW?) This implies that the bytes making
up the call are being delivered more than once, which, if TCP/IP is working,
should not happen _on the same connection_. So, maybe something is
duplicating the connection and the bytes sent on it.
5) Are you ever getting any errors which suggest that only _some_ of the
bytes are being duplicated? I don't know if there are any ASP.NET counters
for this, but it would be interesting if the duplication is of part of a
message as opposed to being of an entire message.

Finally, if you can't solve this problem, or if it's not worth the time to
solve it, you could consider working around it. Have each client-side
request generate a GUID and a timestamp, and maybe some identifying
information about the client machine, and have them both sent with the
request. Record all in the database for debugging purposes, but use the GUID
to determine if the request is a duplicate. Unless the client-side is
issuing the request twice (fat fingers hitting a Submit button twice, for
instance), then you should be safe in ignoring (and flagging!) any request
with the same GUID as one already in the database. If your database code is
set up correctly, the absence of a given GUID in the database would be proof
that this is the original request; the presence would mean that it is a
duplicate and can be logged, and ignored.

I'd also throw an exception to get an error back to the client, who might
then complain about it, thereby uniquely identifying himself... ;-)

Good luck. This sort of thing can be fun if you like mysteries.

John
Aug 31 '06 #2
Hi John,

First, thanks for your very detailed reply.
1) Are the clients all running the same software and the same version of
the software?
Yes, it is the same software. It happens regardless of the version (the
software is updated regularly by me).
2) Are the clients all behind the same network infrastructure, or are some
at different sites or different companies?
Different sites, different companies.
3) Is there any correlation between any subset of clients and the
duplicate messages, or is duplication evenly distributed across all
clients? For instance, maybe it's only the clients at one site which are
having this problem.
It is not specific to certain clients; it happens to all. There are two
logging webmethods in the ws, and it happens to both.
4) Network-wise, on a given connection, TCP/IP is meant to prevent the
same bytes being delivered twice. You say you're seeing a web service
operation called twice (ever more than twice, BTW?) This implies that the
bytes making up the call are being delivered more than once, which, if
TCP/IP is working, should not happen _on the same connection_. So, maybe
something is duplicating the connection and the bytes sent on it.
More than twice even, in some cases even 3 and one case 4...
I also have the feeling something must be duplicating it.
5) Are you ever getting any errors which suggest that only _some_ of the
bytes are being duplicated? I don't know if there are any ASP.NET counters
for this, but it would be interesting if the duplication is of part of a
message as opposed to being of an entire message.
No, never had any errors like that.
Finally, if you can't solve this problem, or if it's not worth the time to
solve it, you could consider working around it. Have each client-side
request generate a GUID and a timestamp, and maybe some identifying
information about the client machine, and have them both sent with the
request. Record all in the database for debugging purposes, but use the
GUID to determine if the request is a duplicate. Unless the client-side is
issuing the request twice (fat fingers hitting a Submit button twice, for
instance), then you should be safe in ignoring (and flagging!) any request
with the same GUID as one already in the database. If your database code
is set up correctly, the absence of a given GUID in the database would be
proof that this is the original request; the presence would mean that it
is a duplicate and can be logged, and ignored.

I'd also throw an exception to get an error back to the client, who might
then complain about it, thereby uniquely identifying himself... ;-)
I was planning to do something like this, but was hoping that the cause
could be found somewhere.
BTW, when the request is proven a duplicate, I would prefer that the
original request is carried out and sends the result back to the client. If
I throw an exception I might give the user the idea that the request has
failed, while the first request is being carried out correctly. What would
be the best way of ignoring the duplicate request?
Good luck. This sort of thing can be fun if you like mysteries.
Thanks, I really hope this can be solved.

- Ed
Aug 31 '06 #3
"Ed Sonneveld" <esonneveld@sun_REMOVE_THIS_base.nlwrote in message
news:44**********************@news.xs4all.nl...
Hi John,

First, thanks for your very detailed reply.
You're welcome.
>I'd also throw an exception to get an error back to the client, who might
then complain about it, thereby uniquely identifying himself... ;-)

I was planning to do something like this, but was hoping that the cause
could be found somewhere.
BTW, when the request is proven a duplicate, I would prefer that the
original request is carried out and sends the result back to the client.
If I throw an exception I might give the user the idea that the request
has failed, while the first request is being carried out correctly. What
would be the best way of ignoring the duplicate request?
I'd consider throwing the exception, anyway, at least while trying to track
down the problem. If the client actually receives the corresponding SOAP
fault, then it indicates that the client was waiting for the duplicate
response, which would be interesting. If the clients never receive the SOAP
fault, then the question would be - who _does_ receive it?

I would not reply with the original reply, since that's actually lying, and
you don't want to lie to a computer. ;-)

You didn't, on the second attempt, take the first action. In fact, what you
did is ignore the request the second time.

If not a .NET-generated SOAP fault, or a custom-created one (by throwing
SoapException), I would add a "duplicate request" alternate success
response. That way, a client that cares can tell the difference between a
request that did something and one which was a duplicate. Even if you don't
care about the difference now, you may later.

John
Aug 31 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Manny | last post by:
I have a web form "Page1.asp" and it reads data from a database, does some calculations, and displays the records in pages. Works fine. I have a button that displays on the page, defined as...
0
by: J.Bijleveld | last post by:
Hello colleagues, At this moment we have a real big problem using a .NET application with an Oracle database (v8.1.6). I hope someone has encountered this problem before and is able to help me...
2
by: J.Bijleveld | last post by:
Hello colleagues, At this moment we have a real big problem using a .NET application with an Oracle database (v8.1.6). I hope someone has encountered this problem before and is able to help me...
3
by: sd | last post by:
Hello All, I aplogize if this has already been answered however I couldn't find anything related to this... I have bunch of webservices written in vb.net returning native data types, due to...
2
by: Peter McEvoy | last post by:
Folks, I've been building a Webservice API for a contract that will be exposed to the internet at large. There are two endpoints, and each endpoint contains a number of webmethods. Every...
2
by: MrDotNet | last post by:
Hi I want pass NameValueCollection as parameter in webmethod. I try it but that give me error. Here is Error. You must implement the Add(System.String) method on...
2
by: Chris | last post by:
In SQL 2005 I have a stored procedure as below: @sub_no smallint OUTPUT BEGIN BEGIN TRANSACTION INSERT...INTO
0
by: Ed Sonneveld | last post by:
Hi, I have hosted my webservice at a hosting company and it has been working fine for 2 years now. The webservice is called by winforms clients over the internet, using the proxy class generated...
5
by: elTonio | last post by:
Hi, I'm building a VB.Net webMethod that need to receive an already built Soap request, and that request cannot be changed, as it's already in use in our other server, so I'm stuck with it....
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
4
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.