Reputation: 1189
We have a asp.net webform application (3.5) & a wcf service hosted via windows service (a service library which is activated when service is started). Both are deployed in same server.
WCF service is used for few long running task.
Now a client want some customized report which is gonna take significant time.
My idea is to show a progress of the task in the UI, but I am struggling with the correct way to do it.
Is it possible in the following way,
On request from page , service starts the processing asynchronously and report the status to some variable. (I don't want to write to database)
A asynchronous polling from client page, which intern communicate with another operation of wcf service to retrieve the the variable value.
Ajax client can communicate with the wcf service but it looks like the service need to be hosted as web application (don't understand much here)
Any Other thoughts? any option on using wcf callback (duplex communication)? too much confused.
Upvotes: 0
Views: 707
Reputation: 11294
You could look into using something like SignalR to push responses from your web application to your client (among other benefits, this uses the comet technique and so reduces the amount of polling you have to do).
To get a response from your WCF service to your web app, you can either use an async request to the service, or use a messaging solution such as Windows Azure Service Bus.
We use Client > JQuery > MVC > WCF > Service Bus > MVC > SignalR > Client
as a pipeline and it works very well for long-running processes.
Upvotes: 1
Reputation: 3268
We achieved something similar a year back.
1) We created a WCF Server with Singleton InstanceMode which processes the request and at the same time keep status as well. Another method e.g. GetStatus returns status to client. It also provides error details, in case of any error. However we also persisted the processing details.
2) On web page we async hit getstatus once request is initialized and showed a progress bar on web page.
This worked great for us.
Upvotes: 2