Newbie: Events in WCF
-
2012年8月16日 上午 04:47
I am just getting started with WCF.
Here is what I want to do:
I am working with a small Client/Server application. I have a flat file on the server - whenever this file is updated I want to update the client UI. I will have a service on the server which will monitor this file and update a DataTable whenever this file is updated and also raise an event. My client app will update the UI whenever this event is raised.
I just want to make sure that WCF is the way to go - is that right? The first tutorial that I am viewing talks about exposing methods / member functions. Can we also expose properties and events in a similar fashion with WCF? Hopefully it is not too advanced!
Any suggestion will be helpful - if there is a simpler way to do this (without using WCF) - please suggest?
Thanks.
所有回覆
-
2012年8月16日 上午 08:41
Yes WCF is the way to go. You need to use a Duplex message Pattern. Using this pattern service can send messages back to the client endpoint, providing event-like behavior. Duplex communication occurs when a client connects to a service and provides the service with a channel on which the service can send messages back to the client. Note that the event-like behavior of duplex services only works within a session.
Refer: http://wcftutorial.net/WCF-Events.aspx or http://msdn.microsoft.com/en-us/library/ms731064.aspx
Lingaraj Mishra
- 已標示為解答 Jay6447 2012年8月17日 上午 03:32

