WCF Service – Exposing Business Logic in Web Applications

asp.netnetwcfweb-applicationsweb-development

I'm working on a middle-tier project which encapsulates the business logic (uses a DAL layer, and serves a web application server [ASP.net]) of a product deployed in a LAN. The BL serves as a bunch of services and data objects that are invoked upon user action.

At present times, the DAL acts as a separate application whereas the BL uses it, but is consumed by the web application as a DLL. Both the DAL and the web application are deployed on different servers inside organization, and since the BL DLL is consumed by the web application, it resides in the same server.

The worst thing about exposing the BL as a DLL is that we lost track with what we expose. Deployment is not such a big issue since mostly, product versions are deployed together.

Would you recommend migrating from DLL to WCF service? If so, why? Do you know anyone who had a similar experience?

Best Answer

The main question to ask yourself is Why Should I (as in what would I gain by) adding WCF to my project. You would gain scalability, but at the cost of increase complexity. Do you need scalability? Flexibility in deployments (different layers can more easily be on different development schedules) is another benefit, but you mentioned that it was a low priority.

I am currently working in an environment with C# WebParts hitting Java WebServices, We have fought back and forth about versioning, tight and loose coupling, APIs, and more, but we always focus on ROI. How much will this architecture change cost over the life cycle of the project, versus how much will we save in maintenance and development cost.

I would say do it. You can add your WCF Service on the same machine that is currently running your web. I believe separation of concerns, flexibility, and scalability would be worth it, as the change should be minimally invasive.