Have you ever came across such situation where you have a RESTful WCF service which has some WebGet or WebInvoke OpertationContract in your ServiceContract. And when you calling one of WebGet API using RESTful URL or from client side application, that API get called twice or thrice at server level. Means your API get execute twice or thrice but your client had called it only once.
I had faced above few with in a yr, but did not able to find out why it was happening, and some how it got fix/working normally. I had done lots many reach on it, like why its happening and how it happening. Enabled all levels of tracing. And found some interesting.
1. I able to prove with my logs that client is only making 1 call to API
2. RESTful WCF service at get executed twice or thrice
3. There are twice or thrice IIS log at server level of that API
I had search google many time but able to get any proper answer for it. But lastly this time, I found perfect solution on it by reading a article from a site
Lear REST[
^]
In that site there was a very strong point was mention which was very basic but that give me reason to think.
GET requests should be for read-only queries; they should not change the state of the server and its data.
Above point make me to think, that do I really doing same with my WebGet API? and my answer was No!!
I was doing some manipulation/object creation/correct of data before getting data in that WebGet (Http GET) API. Then I, change that API to WebInvoke (Http POST) and it worked!! only 1 call received at server and it was process normally and successfully.
Then I started figure out why it was happening such for Http GET. and something which i found is that IIS has some setting for HTTP GET as 40sec replay, so if within 40sec if server does not get response it again query itself. I am not sure how much I am correct here. But my fix worked...
Hope this article is use full for those who are also facing such issue and doing google but did not finding any result or solution. But there answer is here 1st on net.
Thank
Sumit