开发者

What is WCF? and what can it do?

I looked up WCF and i cant exactly figured out what it is. I found this page and it seems to be a way for an app to allow other applications to call functions. Sort of loading a DLL and calling functions but using TCP instead and not loading a DLL but forcing a user to run an app.

I am still confused about it. Can someone explain what it is used for?

It looks like if i run two apps which can host the same service only the first will r开发者_StackOverflowun the rest will get errors? I can call functions, but are there memory limitations? can i pass byte[] as params when allocated on stack or heap? I cannot pass file handles right? (I cant think of a reason why).

Can i have 3 apps be clients and fairly easily? like if i open app1 and open an image. Can i open app2 and 3 and have them do different things to the image currently loaded? (app 1) edit, 2) exported in memory image as different types (animated gif, avi, png, etc) 3) different editing tool or app to see how it will look at runtime


@acidzombie24, to counter your comment to Ryan's answer:

WCF is NOT a remote function call - not at all. Quite the contrary!

WCF is a message based communication system - your clients will have a proxy that has the same method as the server. When you call such a function on the client proxy, what the WCF runtime does is wrap up those method parameters, the method name, and some headers into a serialized message and it sends that to the server.

There is no constant connection like a remoting protocol or a database connection open at all times, between the client and the server. The client packages up a message and send it off. The transport media between client and server could even be SMTP (e-mail) !

Once the server receives the message, the WCF runtime will instantiate an instance of your service class to handle that request. The appropriate method on that service class will be called, the parameters are passed in, the service does its work, and the response is generated. The response then travels back the same way - serialized message across a transport media - to the client.

WCF is a general-purpose, message-based communication system to enable you to create distributed systems - you have a bunch of services somewhere on your servers, which offer up to perform certain functions on the client's behalf, when they call. WCF is something like web services - only much more than that. It's also message queueing (using Microsoft's MSMQ product), net/TCP communication and a lot more. And it's much more extensible than any communication API before.


WCF is really just a networking / communication platform. What you do with it is up to your requirements and skill. Typically it is used in situations where you have a client -> server or n-tier application. Most commonly it is hosted by IIS or Process Hosting service on a server. Then connected to by some client.

WCF does have the ability to transfer data, including images as a byte stream, etc, which it may sounds like what you were eluding too. You are also correct that it would not be correct to pass handles, since you are typically connecting applications across many boundaries (context, appdomain, machine, even domain / network).

Not sure what you are trying to understand about this, but hopefully it helps.


  • WCF is the replacement for ASMX Web Services and for .NET Remoting
  • WCF is a message-based platform for communications
  • WCF is the recommended Microsoft platform for building and consuming web services of all kinds
  • WCF is not limited to HTTP/HTTPS or to hosting in IIS. One can host a WCF service in any process
  • The WCF Developer Center is a good place to start, or maybe in the Beginner guide
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜