[RESOLVED] Multi thread WCF
I'm really baffled and am hoping someone can help., I have the following code.
Code:
<ServiceBehavior(InstanceContextMode:=InstanceContextMode.Single, ConcurrencyMode:=ConcurrencyMode.Multiple)> _
Public Class eMPmain
Implements IIVR
Dim myx As Integer
Private Function testloop() As String
Dim mystr As String = ""
For times As Integer = 1 To 10
myx = myx + 10
mystr = mystr & myx.ToString & Now.ToLongTimeString & vbCrLf
Thread.Sleep(500)
Next
testloop = mystr
End Function
Public Function CreateIVRSession(ByVal ddi As String, ByVal cli As String) As String Implements IIVR.CreateIVRSession
CreateIVRSession = testloop()
End Function
So the response is something like the below.
110 13:20:06
120 13:20:06
130 13:20:07
140 13:20:07
150 13:20:08
160 13:20:08
170 13:20:09
180 13:20:09
190 13:20:10
200 13:20:10
I assumed though if two people called this at the same time that I'd get a mixed up reply with something like (as i have ConcurrencyMode:=ConcurrencyMode.Multiple set)
110 13:20:06
130 13:20:06
150 13:20:07
170 13:20:07
As both clients would be altering the integer myx at the same time. This is not the case though one client runs, while the other client just has to wait. The first client finishes then the other client starts. Which seems single threaded to me.
Am i missing something? Does anything else have to be set to make a new thread fire when poeple call my wcf service?