Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Oct 13, 2009 10:19 AM by asif.kalim
Oct 10, 2009 12:21 PM|LINK
I need to know that what is the right business case to use WCF in an asp.net application. Why Microsoft p&p recommends to use web services/wcf for communicating with database?
Oct 10, 2009 12:54 PM|LINK
when .NET came up webservices were one of the main new topics which were highly hyped. Everything would get connected with everything through the means of the magic buzzwords webservices, uddi, soap, ...
From that point of view a lot of Microsoft, and other companies, architectures were built up around webservices. The companies where I worked also adopted those architectural models and I worked for several years with that myself. Since the last couple of
years however I noticed another trend. Being a consultant it's nice to go and see over the hedge what other companies are doing. Webservices certainly have their value but if you're working on applications that don't need to be exposed to other parties then
they cause a delay in your application and are best taken out.
My current project doesn't use webservices in the architectural design between the presentation layer and the service layer (like proposed by Microsoft). It would cause unnecessary overhead, but the service layer itself's prepared to be able to switch to
WCF whenever needed (for example if a windows client would be installed on enduser pc's that need to connect with the business layers which runs on an application server sitting nicely behind a service) but we do use webservices from our integration projects
to 3rd party vendors who offer data for our endusers. We also use WCF on the presentation layer which we call from ajax to get passed full page postbacks.
So end conclusion: make good use of webservices/wcf where appropriate. Don't put it in your architecture because it looks fancy. If you don't need it or have any special value from it then don't use it.
Oct 12, 2009 09:30 AM|LINK
What i understand from your comments that one should use WCF/web services in case if an application is supposed to communicate with different types of external applications or using wcf with ajax on presentation layer. Please correct me if im wrong.
Furthermore, what could be the advantage of adding a service layer in between a model tier and UI while my service layer is comprising of a set of calsses.
Oct 12, 2009 04:36 PM|LINK
This poster had a good need for using WCF services -
http://forums.asp.net/t/1478962.aspx, may be of interest to you.
Oct 12, 2009 06:31 PM|LINK
There is a good article from the MSDN that goes into why one would want to use WCF for different scenarios. I especially like the description given for an Intranet Services scenario as posted below:
"Service Oriented Architecture (SOA) is the evolution of component-oriented programming making it possible to encapsulate, reuse and distribute business functionality with the added benefit of interoperability across technology platforms. ..."
"WCF supersedes .NET Remoting and Enterprise Services as the preferred technology for distributing functionality across process and machine boundaries behind the firewall. With WCF, business functionality can be distributed as services and configured to
support the appropriate protocols that satisfy performance, reliability and security requirements for the application."
Application Deployment Strategies: WCF
The descirptions might be ones used often, but they really get to the point. The question is when do I use WCF with ASP.NET? There are a lot of scenarios where it
does make sense if you follow the guidlines of what WCF is made for: distriuted services. If your application
needs to deploy some sort of shared logic to be consumed by several applications or processes, then WCF may be a good canidate. If you are looking to farm out your BLL .dll to a service, that is only good to your (1) application just to be have a
'SOA', then it is a waste and will create unnecessary overhead for the network or http calls that have to be made to the service.
A really generic example could be a set of amoritization calculations for a mortgage company. These calculations would be used over and over again by multiple applications, and might be a good canidate for porting out to a WCF service. The service could
have functionality even to allow external (authorized) clients to consume the service as well to get customer information or use that same calculation logic.
Now if you have a BLL .dll where the business rules are so specefic that they really only make sense to the single application, then why migrate that logic out to a service with the additional overhead?
These example are extreamly abstract, but so was the original question. Your overall needs and requirements should dictate if you need some shared distributed logic that can be ported into a WCF and shared amoung clients.
Oct 13, 2009 10:19 AM|LINK
Let me explain my architecture in more details.
I will divide my application into three logical tiers.
1- Core (Domain Objects. Business Logic, Utitlities)
2- Persistance (NHibernate Repositories)
3- Web (I will prefer to use WCSF here)
Now i want my application to be db indpendent and thats why i choose NHibernate. To achieve db independence, i will avoid to write stored procedures in my application that i have been using previously to do complex calculations and implementing business
logic. I am unsure that what could be the best replacement of stored procedures in my current architecture. Because there would be several routines that will be scheduled to run on a certain time. And what could be the replacement of db triggers in this scenario?
I would be very thankful for you guidence in this regard.
Thanks for your support!