Nigel Findlater
Nigel Findlater

Reputation: 1724

What is the best way to send progress information from WCF to the browser?

I have an MVC application using Razor, html5 and a WCF service. The problem is one WCF service takes a long time to run which means that the user has no indication what the service is doing. I would like to send progress information to the HTML5 client and would like some suggestions over what the best approach would be. All help will be gratefully received…

Upvotes: 2

Views: 1073

Answers (2)

Anand
Anand

Reputation: 14915

You could even use SignalR for the Reverse Ajax purpose. If you want to shy away from these heavy framework, and probably want to go with setInterval you can check out this article This article is by Dino Espito, in which talks about how to use setInterval to make repetitive call to server to get the progress. Another one by Dino Espito in which he uses SignalR libarary to make a context sensitive progress bar

For Full Collection of his article on Context Sensitive Progress Bar See here

Upvotes: 2

VJAI
VJAI

Reputation: 32758

You have to go for Comet implementation. In the case of Comet or Reverse Ajax the client will send a long duration ajax call to the server and wait for a response. So in your case first the HTML5 client will send a request to the server and wait for the progress information once the WCF service returns some info back the client has to make the again make the long duration call till the process is completed.

There are open-sources available that helps to simplify your work like nComet or PokeIn.

There is also an article available in code project that talks about this approach.

Upvotes: 1

Related Questions