none
Rest Service method called twice in wcf RRS feed

  • Question

  • Hi all,

    I have created a rest service using wcf.
    I am writing Entity framework code within a service method to fetch data from database.

    Every call from browser is hitting the service method twice or thrice.
    I found no exception within the method. I encountered same problem before and solved it adding DataContract attribute to all the models(not helping now).

    What may be the possible reasons? Please help.

    Regards
    Ashish
    Sunday, February 9, 2014 2:46 PM

Answers

  • Hi,

    I want to know if you are using the WebGet (Http GET). If so, please try to change that API to WebInvoke (Http POST).

    Because IIS has some setting for HTTP GET as 40sec replay, so if within 40sec the server does not get response, then it will query itself again. Then it will be called twice or more.

    For more information, please try to refer to:
    #RESTful API in WCF get called more than one time:
    http://www.codeproject.com/Tips/338142/RESTful-API-in-WCF-get-called-more-than-one-time-b .

    Best Regards,
    Amy Peng


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, February 10, 2014 7:40 AM
    Moderator

All replies

  • Hi,

    I want to know if you are using the WebGet (Http GET). If so, please try to change that API to WebInvoke (Http POST).

    Because IIS has some setting for HTTP GET as 40sec replay, so if within 40sec the server does not get response, then it will query itself again. Then it will be called twice or more.

    For more information, please try to refer to:
    #RESTful API in WCF get called more than one time:
    http://www.codeproject.com/Tips/338142/RESTful-API-in-WCF-get-called-more-than-one-time-b .

    Best Regards,
    Amy Peng


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, February 10, 2014 7:40 AM
    Moderator
  • Hi Amy

    I am using Webinvoke POST only but still my methods are hit twice, can you advice how to prevent this. Due to this my database is being updated twice.

    Thanks

    Monday, February 2, 2015 8:48 PM
  • Hi ,

    Please,if y find a solution can y mention it.i need yr help

    Tuesday, February 17, 2015 11:28 AM
  • Check your return type, class may be contain one or more parameter as a datetime first comments those parameter. its working properly call only once.
    Wednesday, June 10, 2015 9:37 AM