Link to home
Start Free TrialLog in
Avatar of Larry Brister
Larry BristerFlag for United States of America

asked on

Server vs PC and Windows Service

I have a Windows Service built in VB.Net Visual Studio 2010

What it does is
Reads a series of phone numbers
For each # starts a different thread
each thread does a HttpWebRequest POST Chunked data
Each POST gets the response and keeps the response stream open indefinitely
While the stream is open it sends the (chunked) data to SQL Server via a Web Service

On any PC WinXP SP1 and greater it runs perfectly

On any server the threads seem to "replicate" the data in the push through the Web Service.

I have the runn and the install for any CPU.

You can see in the screen print below that I have it set to
Active (Any CPU)

I also tried "Any Platform"

Any suggestions?


User generated image
Avatar of Nasir Razzaq
Nasir Razzaq
Flag of United Kingdom of Great Britain and Northern Ireland image

>On any server the threads seem to "replicate" the data in the push through the Web Service.

You mean the same data is being inserted twice?
Avatar of Larry Brister

ASKER

CodeCruiser

That's correct.

Just on the start up

My code has an If Else that if I get no response on a particular thread...it launches a new thread, and kills the current one without ever going near the WCF
ASKER CERTIFIED SOLUTION
Avatar of Nasir Razzaq
Nasir Razzaq
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
CodeCruiser,
  That would seem correct...
But my threads in their "Launch" to the HttpWebrequest are on a timer.
The vendor only allows 7 "requestStarts" at a time.

Over the last month I've found it takes a max of 1/2 second per, so I have a sleep in between of 1 full second for each thread starting

Not sure if I just replied correctly to your post
It could be that the thread is sleeping when you check it. Can you show the code that checks the thread?
CodeCruiser,
  I need to get back to the dev machine which will be later today.

I'm stuck in a never ending soul killing meeting right now
ok :-)
Code Cruiser...
You asked for the code for the whole process...or just the thread being kicked off?

Inside a While datatablerows.count > 0

I have this
If Not sendRow Is Nothing And sendRow.Length > 20 Then
  'Declare and start individual thread for each (phonelist) loop
   Dim phoneWorkerThread As New Thread(AddressOf startPhoneMonitoring)
   phoneWorkerThread.Name = "Thread " + CStr(threadCounter) + " | [" + dataRowString + "]"
   phoneWorkerThread.IsBackground = True
   phoneWorkerThread.Start(phoneWorkerThread.Name.ToString + "|" + sendRow)
End If

then some logic that removes the datarow just sent from the datatable at row(0)

Then my "sleep" line.
I set the delay variable in the top of my class.  Right now its 1.5 seconds
But I've tried everything up to many seconds (7-8) with the same problem.

System.Threading.Thread.Sleep(requestDelay)


End While
Finally got back to this and was able to track it down.

Moved things into more of a sequential and less of a concurrent process