locked
WCF Rest Service calls overlapping RRS feed

  • Question

  •   We have C# rest service that is being call using ajax calls from our UI.

    the service is used to return datatables from SQL server calls.

    It appears we have some sort of threading or sync problem as we are getting situations where a GET to return table A is actually returning

    the results from a GET to table B which was called at the same time.

    I realize I should post code but I wanted to know if there was something basic around how we have IIS 7.0 set up or something basic that we may have missed in the code.  we started with a base WCF template from VS2010.

    We can follow up with code as needed.

    Any suggestions would be appreciated.

    Friday, June 8, 2012 2:46 PM

Answers

  • Once a connection is made it doesn't close instantaneously.  Services are run off the 100msec timer tick.  You may need to add lock (see webpage below)  so when you service functions are called they don't allow another service to run until they complete.

    http://msdn.microsoft.com/en-US/library/ms173179(v=vs.80)


    jdweng

    • Marked as answer by Yi-Lun Luo Tuesday, June 26, 2012 2:19 AM
    Friday, June 8, 2012 3:33 PM

All replies

  • A TCP connection (which WCF uses) consist of a Source IP address, a Destiantion IP address, and a Port Number.  You can only have only one connection at a time with the same 3 parameters.  If you want to make a two connection between the same source and Destinaation IP address you need to use a different Port Number for each connection.

    jdweng

    Friday, June 8, 2012 3:18 PM
  •  At the same time means within milliseconds of each other.    So the calls are not technically "at the same time"

    Friday, June 8, 2012 3:22 PM
  • Once a connection is made it doesn't close instantaneously.  Services are run off the 100msec timer tick.  You may need to add lock (see webpage below)  so when you service functions are called they don't allow another service to run until they complete.

    http://msdn.microsoft.com/en-US/library/ms173179(v=vs.80)


    jdweng

    • Marked as answer by Yi-Lun Luo Tuesday, June 26, 2012 2:19 AM
    Friday, June 8, 2012 3:33 PM
  • We considered that but I guess we assumed that the webservice by nature would take care of itself. 

    Sounds like we are mistaken on an important point,  that being the assumption that each call to the webservice would by default instantiate its own copy of the dll.

    Friday, June 8, 2012 3:54 PM