I have a webservice method which takes an Id and then will kick off a class library to process some infomration about the Id given.
The Processor uses the Trace.Write() stuff to report progress back. This works well on a console app, but I want to be able to send the same information back to the user via the web.
What would be the best way to capture these trace events (which happen very fast, many per second) and to send them to the browser.
I could store the entire trace and send back when the process is complete, but if it could be streamed to the browser as it was happening, then it would provide user feedback as well as information about the process to the user.
This is an ASP.NET service, ashx file.
What is the best way to achieve this?
Thanks in advance
here is my code to kick off the process:
function ProcessEmail(emailId) {
var popupcontent = $("#EmailPopUp");
$.ajax({
type: "POST",
async: false,
url: "/MailboxPro/Methods/Emails.ashx?action=TestProgress",
data: { EmailId: emailId },
success: function (result) {
alert("result");
}
});
}
The problem was caused by the listener still being “attached” to the output.
Calling
Listeners.Remove(myListener)at the end of the process, meant it would work each subsequent times.