I'm comparing two examples of WCF.
Microsoft's examples http://msdn.microsoft.com/en-us/library/ms734712.aspx uses app.config file, uses generator svcutil.exe
to generate client and in general produces much more code.
Another example http://www.switchonthecode.com/tutorials/wcf-tutorial-basic-interprocess-communication much simpler - only two C# files, no auto generated code, no app.config.
Both examples seems to do the same thing.
The question is:
Windows Communication Foundation (WCF) is a framework for building service-oriented applications. Using WCF, you can send data as asynchronous messages from one service endpoint to another. A service endpoint can be part of a continuously available service hosted by IIS, or it can be a service hosted in an application.
WCF Applications came into the picture in . Net 3.0 Framework. This is a framework, which is used for creating Service oriented Applications. You can send the data asynchronously from one end point to another.
WCF is a best fit for scenarios like message queues, duplex communication, end-to-end message security, one way messaging, distributed transactions, etc. WEB API is a best fit to create a resource-oriented services using HTTP/Restful and it works well with MVC-based applications.
Starting with . NET Framework 4.5, WCF provides an easier way to configure both self-hosted and web hosted services in code.
WCF allows you to configure the bindings either programmatically or via configuration. Configuration is sometimes convenient if you (or someone else like a test team/customer) trying out different binding options. For example, the QA team could be doing perf testing and trying the different ways to serialize data over the wire. Or, a customer may have different firewall constraints etc...
In both cases, being able to change binding options on the fly without recompiling is useful.
If you know exactly how you want to send the data, then programmatically configuring it and compiling it into your code may be best. It's certainly easier to configure and less error prone.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With