1

In our application we are using windows service & WCF service. One of the task of the application is as follows:

  1. Client copy file (large file) in specific server location using our admin web site.
  2. We have a Windows service which pick up the file from server & dump data to database.
  3. WCF service used those data to during service call.

We need solution for following situation

  • If file copy is in progress windows service should not pick-up that file. How to identify that?
  • If widows service is running and in that moment if any service request comes WCF service need to response that "windows service is processing data so please make request again after sometimes". How to identify that the windows service is running?
tshepang
  • 12,111
  • 21
  • 91
  • 136
Paul
  • 457
  • 2
  • 11
  • 26
  • You want to inform the caller to a WCF service that is hosted in a Windows service that the Windows service is "running"? Any response from the WCF service means the Windows service *is running*. That seems really obvious, could you clarify that's actually what you're asking? – Peter Ritchie May 06 '13 at 17:00
  • I have edited the question. Basically i want to know two things : 1. Is there any way know if file coping is in progress.? 2. Is there any way to know if a particular windows service do doing its processing? – Paul May 06 '13 at 17:35
  • It might be best to split this into two questions as they are unrelated. – ChrisF May 06 '13 at 20:05

1 Answers1

1
If file copy is in progress windows service should not pick-up that file. 
How to identify that?

You can use .Net FileWatcher class, a useful sample could be found here

How to identify that the windows service is running

I think your windows service must be started when OS is starting,
If you want to know if file process is being done by the windows service, you can implement Singleton pattern (sample) or use Locking by Mutex or semaphore.

Community
  • 1
  • 1
Mohsen Heydari
  • 7,256
  • 4
  • 31
  • 46