Pass object from an app to another [duplicate]
Possible Duplicate:
In .NET Windows Forms, how can I send data between two EXEs or applications?
I have a win app and a web app developed in .Net Framework 3.5. I want to pass an object from web to win app. I want the receiver app be notified from coming object and recive it. What are the solutions?
As with all things on the Web. You need your client to poll the server in certain periods to see if there is anything new. You usually do this through a Web-Service or some special page dedicated to this.
Once you know that there is new data to be had you simply have to decide on a serialization format and use it on both sides
As you have provided too little detail on the structure of the object to really answer this here are the general options and caveats:
Serialization Format: you can opt for XML, Json or some custom serialization. It simply depends on your tastes and needs. For JSon I'd suggest Json.NET from NewtonSoft while for XML you could use the built in formatter.
Serialization is no way to really send objects over the wire. You can't send a class over to your client that should then execute code on the server. Serialization is meant as a way to send data over the wire - objects with behavior simply won't work.
If these apps are both running on machines on the same network, you could use a self-hosted WCF service in the windows app, and have the web app invoke that service (which would notify the windows app that it has received something)
See this MSDN article: http://msdn.microsoft.com/en-us/library/ms731758.aspx
1, Web app serialize object to xmlfile
2, Win app create a listener to check the xmlfile is exist
3, if exist , deserialize it to object
精彩评论