5

I have a service that does image processing. The time that it takes for the process to complete is something like 2-3 minutes. Can I update the client with the progress of the service? can I somehow tell the client that process reached step3 or something like that?

I am using WCF

Ryan
  • 5,456
  • 25
  • 71
  • 129

3 Answers3

2

You can look at the duplex bindings, which supports two way communication:

http://msdn.microsoft.com/en-us/library/ms731064.aspx

It works using a callback mechanism.

hendrikswan
  • 2,263
  • 1
  • 20
  • 25
1

Sure you can. Use some asynchronous method of WCF to get image processing % value. I mean you have to create this method. And on the client side you have to call this method periodically.

NoWar
  • 36,338
  • 80
  • 323
  • 498
  • So you suggest updating the progress in a database – Ryan Nov 30 '11 at 19:38
  • You have to find a way to share % value between the method which does image processing and async. methods is going to provide to the client this value. Probably it could be a database... Also you can have a look here http://stackoverflow.com/questions/7815087/wcf-methods-sharing-a-dictionary. If you will use a database approach make sure that this value belongs to certain user session as well. – NoWar Nov 30 '11 at 19:44
-1

This is baked into a couple of the .NET assemblies. Have you looked at the WebClient class for example? There are *ProcessChanged event handlers, like DownloadProgressChanged.

Just add these in and wrap them around your methods that take time, e.g. ProcessImage().

user118190
  • 2,139
  • 7
  • 29
  • 45