Click here to Skip to main content
11,927,378 members (45,253 online)
Rate this:
Please Sign up or sign in to vote.
See more: C# threads WebService

I have created web service. Server is pushing data to my service frequently (1000 in in 15 min). I want to send acknoledgement saying xml is correct and need to process that data after sendin acklowledge.

How can i achieve this in web service?
public string temp(string)
     //validate xml
     // store into obj

i want to implement threading here 
     //send acknowledgement

     //do some calculations on data and store into database
Please help me how to achieve this?

Thank you.
Posted 6-Jul-12 9:05am
Edited 7-Jul-12 0:55am
Wes Aday 6-Jul-12 14:11pm
So go ahead and create a thread. You already know what it is that you want to do so go do it.
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Personally I don't think putting threading into a web service is a very good idea especially if it's IIS hosted as you run the risk of putting the IIS worker processes into an unhealthy state. I'd create another WCF service, self hosted, as is always my preference, which is hidden somewhere behind your web servers. This service does the processing.

When you create this service, make use of the IsOneWay option on the operation contract option. With one way contracts the call doesn't wait for the process to the complete, it simply sends the data.

The following is information about one way contracts.[^]

Note all the examples return void. That's because they don't wait, they can't return anything so they have to return void.
Rate this: bad
Please Sign up or sign in to vote.

Solution 3

I wish i could use WCF. But requirement is to use VS 2005 and web service(ASMX / SOAP) only. So if you can please give any other suggetion to acheive this in web service.

Thank you.
Stephen Hewison 6-Jul-12 16:18pm
Another option is once the XML is validated store it in a job queue within SQL. Then have a bog standard windows service which polls the queue table for jobs.
Stephen Hewison 6-Jul-12 16:20pm
By a job queue I mean a table which store the XML in the order they were received. Your service then process them in the order they were received.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web03 | 2.8.151126.1 | Last Updated 7 Jul 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100