title: Stored procedure called multiple times when it should be called only once
body: <p>I am having a bizarre problem. I will explain a little about the architecture of the solution first. </p>
  
  <p>We have a mobile application on both Android and iOS that is being served by WCF RESTful web services. The web services are hosted by IIS 7 and they are a proxy to a service layer that runs as a windows service. The web services communicate with the service layer using WCF TCP binding. </p>
  
  <p>The service layer calls stored procedures in a SQL Server 2008 instance. We are using .NET Framework 4 and Microsoft Enterprise library version 5.0. Many of the web service call results in stored procedure calls.</p>
  
  <p>Now, the problem. One of the web services is causing a single stored procedure to be called many times within a second for a single web service call. We have used the trace utility on SQL Server and we can see the stored procedure being called many times with the same set of parameters. This is causing huge performance problems on our web site.</p>
  
  <p>I have no idea what is causing this. It is the same stored procedure that gets called multiple times. I have looked at the IIS logs and the devices are not calling the web service multiple times so it must be an internal bug. I have looked at the implementation of the web service and the service layer and there is no loop that would causes the stored procedure to be called multiple times. </p>
  
  <p>I would appreciate any insight on this. I have no idea what is causing this but I suspect a bug in WCF or Enterprise library. </p>
  
  <p>Thanks for reading.</p>