Does WCF really replace .NET Remoting?

2019-03-19 12:25发布

问题:

I can understand that WCF is in general better than Remoting, but the two seem quite different to me. MS make this pretty picture to show how great WCF is (or perhaps how poor the other techs are to only check one box each): alt text http://i.msdn.microsoft.com/dynimg/IC371617.jpg

But, WCF is centered around SOA and I don't think it's correct to assume every networked application wants to expose services.

In my case I'm looking at ways to replicate objects between two instances of a server application on different PCs. WCF appears to just give a modern version of COM... get an object and call methods and it magically calls the version on the other PC. But Remoting appeared to do something quite different and I'm not clear why it was deprecated without being replaced with a similar technology.

So, do MS even claim Remoting is dead? Or do they still support it, acknowledging it has its place alongside WCF?

回答1:

It really does replace .Net remoting. You can use a binary formatter with a Tcp channel and get the same experience as remoting.

For your case, remoting doesn't really seem to be the right choice. If you want to replicate objects, as in make copies of them in a different location, then you want to serialize them and send them as a bundle (a "message" in WCF lingo) to be loaded into a type (could be the same type in the same assembly, but deployed on a different server) on the remote endpoint. This is where WCF excels. Remoting would give you a connection to a "live" object from one endpoint to the other.