WCF Service Layer in n-layered application: performance considerations

Question #0: is this a good enterpise application template in your opinion?

Yes, for most middle-of-the-road line-of-business applications, it's probably a good starting point.

Question #1: where should I host the service layer? Should it be a Windows Service or what else?

If you're serious about using WCF services, then yes, I would recommend self-hosting them in a Windows service. Why? You don't have to have IIS on the server, you don't have to rely on IIS to host your service, you can choose your service address as you wish, and you have complete control over your options.

Question #2: in the source code provided the service layer expose just an endpoint with WSHttpBinding. This is the most interoperable binding but (I think) the worst in terms of performances (due to serialization and deserializations of objects). Do you agree?

No, the most interoperable would be a basicHttpBinding with no security. Any SOAP stack will be able to connect to that. Or then a webHttpBinding for a RESTful service - for this, you don't even need SOAP - just a HTTP stack will do.

What do we use??

  • internally, if Intranet-scenarios are in play (server and clients behind corporate firewall): always netTcp - it's the best, fastest, most versatile. Doesn't work well over internet though :-( (need to open ports on firewalls - always a hassle)

  • externally: webHttpBinding or basicHttpBinding, mostly because of their ease of integration with non-.NET platforms