title: Web service not handling multiple simultaneous request from same application with proxy class
body: <p>I have an application scheduling multiple tasks which are calling different web services, some the same web service but different method. Each task is executed in an interval and each task is running in its own thread. To obtain reference to the webservice I have a wsdl.exe generated proxy class which is instantiated inside each of the tasks and allways disposed. However when running the application, the tasks are actually waiting for eachother at the service requests, web service doesnt process the service request from task y before its done processing request from task x (I can see this because a service call from task x may take 5 minutes and task y 100 milliseconds, however if y is starting when x is running, it finishes 100 milliseconds after x is done).</p>
  
  <p>This is code from a task (running inside its own thread):</p>
  
  <pre><code>public class TaskX : TaskWrapper
  {
      public TaskX(Guid id, string name, EventQueue eventqueue)
          : base(id, name, eventqueue)
      {
      }
  
      protected override void DoTask()
      {
  
          try
          {
              var factory = new ServiceReferenceFactory();
              using (var reference = factory.GetServiceReference())
              {
  
                  bool result;
                  bool isSpecified;
  
                  reference.Run(out result, out isSpecified);
              }
          }
      }
  }
  </code></pre>
  
  <p>This is the code from the factory method mentioned above:</p>
  
  <pre><code>public ProxyClassService GetServiceReference()
      {
                      var refer = new ProxyClassServiceNamespace.ProxyClassService();
                      refer.Timeout = 1000 * 60 * 60;
  
                      return refer;
      }
  </code></pre>
  
  <p>Does anyone know why I'm experiencing this behaviour?</p>
  
  <p>EDIT:</p>
  
  <p>Here is some logs from tasks after I added [ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall)] to the implementation of my wcf service. I made none configuration changes to a wcf service created in visual studio 2008.</p>
  
  <p>15:02 - Task started: TaskXWithInternalException</p>
  
  <p>15:02 - Task started: TaskYQuickOne</p>
  
  <p>15:02 - Task ended: TaskYQuickOne
  Task elapsed time: 00:00:00.1214762</p>
  
  <p>15:02 - Task started: TaskZSlowOne</p>
  
  <p>15:03 - Task started: TaskXWithInternalException</p>
  
  <p>15:03 - Task started: TaskYQuickOne</p>
  
  <p>15:05 - Task ended: TaskZSlowOne
  Task elapsed time: 00:03:11.6510947</p>
  
  <p>15:05 - Task ended: TaskYQuickOne
  Task elapsed time: 00:02:09.7311905</p>
  
  <p>15:06 - Task started: TaskYQuickOne</p>
  
  <p>15:06 - Task ended: TaskYQuickOne
  Task elapsed time: 00:00:00.0546980</p>