ASP.NET MVC 3 real time events.

2019-08-16 18:25发布

问题:

I'm looking for advice regarding asp.net mvc 3 support for real time events display and handling. The typical scenario would be events like startup,shutdown, soft-reset, cache complete etc, issued on the the server and displayed immediately in the brower app, in near real time.

What is the typical mechanism to support real time events in asp.net mvc 3? Is there a listener mechanism similar to WPF event handing, or would I need to poll for them using AJAX.

I'm not planning to use any external or third pary applications to handle the events, like e.g. Pusher.

Bob.

回答1:

I am unaware of any built-in listener mechanism similar to WPF event handling.

In the past, I've had success with Ajax-polling. I implemented a thread-safe queue-based TraceListener which I would use to log events when they occurred, and on the poll action dequeue all of the backed-up trace logs.