ASP.NET - why wcf is required

Asked By srikar
20-Sep-11 06:26 AM
why wcf is required
give me some example
  Web Star replied to srikar
20-Sep-11 06:35 AM
When you need any Values or object that should come from another application you use WCF or any other distributing system, 


advantages of WCF,

•Its made of a lot of different components, so you can create new components for security, transport, authentication
•Its faster than ASMX
•Supports Scaling/Load Balancing
•Its Interoperability, for java, and more..
Advantages of WCF?
http://srinutamada1.wordpress.com/category/technology/advantages-of-wcf/
  Suchit shah replied to srikar
20-Sep-11 06:38 AM

In short WCF is a unification technology which unites the following technologies:-
 √ .NET remoting
√ MSMQ
√ Web services
√ COM+.
Below figure depicts WCF fundamentals pictorially.


Long Long time a ago there lived a hard working and a nice architecture. He used to work for a travel agent with his small and happy team software professionals. Travel agent had tie ups with many big flight carriers. The nice and hardworking architecture and his team developed a nice booking engine by which you can book tickets through any of the flight


carriers. The Travel Agent Company was very happy with the architecture and his team member’s achievements. As time passed by the travel agent’s business grew in multiples. Travel agent started his own franchise. Travel agent wanted to provide this booking engine service to his franchise. So one fine morning he called the hard working architecture. Architecture was very excited of the new work and started on it day and night. He prepared a list of franchise and made personal visits to see what infrastructure they had. He saw all the franchise worked in Microsoft Windows platform. Booking engine was located in the main head office and all the franchise should communicate to this booking engine. After discussing with his team members he concluded that the best way to communicate is .NET remoting because the head office where the booking engine was hosted was also on windows platform and the other franchise where also on the same. He then worked day and night with his team members to implement .NET remoting to enable communication between the franchise and the booking engine hosted in the head office. After months he rolled out his project successfully. Travel Agent was very happy with his architecture and the team. Travel agent was now providing his booking service to his franchise in the most efficient manner. Time passed by and because of the good automated booking service more companies wanted to take the franchise from the travel agent. But the big issue was many of the franchise did not have windows operating system. They worked on Linux and other Non-Microsoft operating systems. Due to this limitation travel agent was loosing lot of franchise business. So one fine day they again called the Architecture and said that the booking engine should also be available to Non-Microsoft platforms. Architecture again went in to action. He setup a high level team meeting and discussed the best solution on Non-Microsoft platforms. After long discussion’s they concluded Web services as the solution. His team again went in to action and implemented the solution. So now his booking engine architecture was working with two technologies .NET remoting and Web services. He kept .NET remoting so that he can get speed and performance benefits from common windows platform and he also kept Web services so that he can operate seamlessly with Non-Microsoft platforms. Travel agent was now at his peak of happiness as he had the world at his tips. Franchise now started making huge ticket bookings through the booking engine. Booking engine had the capacity of serving 20 tickets / second but it had now to serve 50 tickets / second. End franchise client had to wait to get response and was not able to process the next ticket booking until the first one was served. Travel Agent started receiving huge

complaints because of this synchronous processing. They again called the architecture and proposed the problem before him. Now architecture was really at a fix as he did not wanted to touch the booking engine logic to increase performance. So he concluded to use MSMQ (Microsoft Message Queuing) service. He analyzed that the main problem was that the travel agent had to wait until his first ticket booking is not completed. So when the travel agent makes a booking it will come and fall in the queue and release the travel agent. Booking engine will always poll for this queue. When the booking engine finishes he will publish the booking results back to the queue. Travel agent client can then come at his leisure and see the results. Again he and his team mates implemented this solution. Every one in the travel company was really happy and impressed by the architect and his team members. As time passed by the booking engine was serving huge ticket bookings. Travel Agent then felt a huge necessity of a good security model with the booking engine. Again the architecture was called; he again had a kick of meeting and proposed WSE as the security solution. Implemented the same and everything was fine.

After some days travel agent wanted to start a scheme to book group family ticket bookings through the booking engine. Till now the travel agent was booking one ticket at a time. But soon he started getting lot of orders to book group family tickets. He wanted to incorporate the same in the booking engine with consistency. Consistency means if any of the ticket booking fails in the family booking all the tickets should be cancelled. In short either all the tickets in the family are booked or none of them. Looking at the need Architecture thought to use COM+ Services to manage transactions. Below is the top level design document of the project. Architecture and his team were now feeling the pressure and heat of managing multiple technologies to achieve. The happy architecture now started becoming frustrated. His team members started slogging for night as they had to work on multiple technologies at one time.

  

  
  srikar replied to Web Star
20-Sep-11 06:41 AM
Thax u Sir,

i want this in interview patten. i know wcf i have to expalin it in interview so am asking.
  Reena Jain replied to srikar
20-Sep-11 06:45 AM
Hi,

the answers of your question as is follows...

1. why we need WCF

As the developer we are more focused on the business logic services and need not worry about channel stack. WCF is a unified programming API for any kind of services so we create the service and use configuration information to set up the communication mechanism like HTTP/TCP/MSMQ etc.

WCF is a unifying programming model. It is meant to define a singular way for writing services and therefore unify things like Web Services(.asmx ), .Net Remoting , Message Queue (MSMQ) ,Enterprise Services ( COM + ) ,and Web Service Enhancements ( WSE ). It does not replace these technologies on individual basis. Instead , it provides a single programming model that you can use to take advantage of all of these items at once. With WCF you can create a single service that can be exposed as HTTP, TCP , Named Pipes and so on. You also have multiple hosting options.


2. How do we do security in WCF

It depends on what kind of security you want. Should the protocol be encrypted, should the data be encrypted, or do you just want to authenticate a user. In the last case you can just go ahead and use whatever technology you want to verify that the user has permissions to use the API.
Here is good link on this

http://msdn.microsoft.com/en-us/magazine/cc163382.aspx
  Sreekumar P replied to srikar
20-Sep-11 06:50 AM

Hi,

Those are absolutely different technology. WCF does not replace EF or Linq. EF is object relation mapper for mapping between database and objects. Linq to SQL is entry level object relation mapping with very limited features. WCF stands for Windows communication foundation. It is API for creating web services = communication between applications. You can use EF to load data from DB and WCF to expose that data to other applications.

WCF – Windows Communication Foundation, has become in fact more of a foundation for a larger set of abstractions on top it. Simply put WCF is a set of fundamental plumbing components with powerful extensibility features. But is not the easiest of things to use and configure.

The options now for more out of the box ready solutions that wrap and exist on top of WCF are:

  • http://msdn.microsoft.com/en-us/library/ee707344%28VS.91%29.aspx and the Silverlight http://www.silverlight.net/getstarted/riaservices/
  • http://msdn.microsoft.com/en-us/data/bb931106.aspx (code-name was Astoria, and was also ADO.NET Data Serivces).
  • and even http://blog.nick.josevski.com/2010/05/10/so-what-is-odata/.

These frameworks/abstractions/concepts are intended to simplify creating and deploying your web accessible service offerings.




See if below link is useful...

http://msdn.microsoft.com/en-us/library/aa738737.aspx

  James H replied to srikar
20-Sep-11 07:23 AM
Acronym WCF stands for Windows Communication Foundation. If your aplication needs to share information with other applications over HTTP, you generally do this by creating a web service. But the major problem with web service is that somewhere it may latfoerm/technology dependent & have some related limitations. Due to this your service may failed to communicate in between inter OS or like. To overcome this prob. microsoft provided WCF. WCF is a Service Oriented Application (SOA) & with this, your application can communicate with any type of application. Here, OS or platform/technologies are not a barrier

For more detail, refer: http://en.csharp-online.net/WCF_Essentials%E2%80%94What_Is_WCF%3F
  smr replied to srikar
20-Sep-11 07:23 AM
hi

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.

refer links

http://msdn.microsoft.com/en-us/library/aa702682.aspx

http://forums.asp.net/t/1480028.aspx/1

http://www.slickit.ca/2009/04/wcf-using-wcf-with-net-20.html

Create New Account
help
Time (US & Canada). [11 / 17 / 2011 19:10:25.0731] [0] Operating System version: Microsoft Windows NT 6.1.7601 Service Pack 1. [11 / 17 / 2011 19:10:25.0731] [0 the server.). [11 / 17 / 2011 19:14:14.0479] [1] Executing: if($RoleInstallWindowsComponents) { # Install any Windows Roles or Features required for the Client Access role Install-WindowsComponent -ShortNameForRole "CAS" -ADToolsNeeded $RoleADToolsNeeded MSExchangeADTopologyService, 1484, msftesql, 1532, svchost, 1552, SMSvcHost, 1576, Setup, D: \ Setup.EXE 1576, Setup, C: \ Windows \ SYSTEM32 \ ntdll.dll 1576, Setup, C: \ Windows \ system32 \ kernel32.dll 1576, Setup, C: \ Windows \ system32 \ KERNELBASE.dll 1576, Setup, C: \ Windows \ system32 \ ADVAPI32.dll 1576, Setup, C: \ Windows \ system32 \ msvcrt.dll 1576, Setup, C Windows \ SYSTEM32 \ sechost.dll 1576, Setup, C: \ Windows \ system32 \ RPCRT4.dll 1576, Setup, C: \ Windows \ system32
Time (US & Canada). [11 / 17 / 2011 19:10:25.0731] [0] Operating System version: Microsoft Windows NT 6.1.7601 Service Pack 1. [11 / 17 / 2011 19:10:25.0731] [0 the server.). [11 / 17 / 2011 19:14:14.0479] [1] Executing: if($RoleInstallWindowsComponents) { # Install any Windows Roles or Features required for the Client Access role Install-WindowsComponent -ShortNameForRole "CAS" -ADToolsNeeded $RoleADToolsNeeded MSExchangeADTopologyService, 1484, msftesql, 1532, svchost, 1552, SMSvcHost, 1576, Setup, D: \ Setup.EXE 1576, Setup, C: \ Windows \ SYSTEM32 \ ntdll.dll 1576, Setup, C: \ Windows \ system32 \ kernel32.dll 1576, Setup, C: \ Windows \ system32 \ KERNELBASE.dll 1576, Setup, C: \ Windows \ system32 \ ADVAPI32.dll 1576, Setup, C: \ Windows \ system32 \ msvcrt.dll 1576, Setup, C Windows \ SYSTEM32 \ sechost.dll 1576, Setup, C: \ Windows \ system32 \ RPCRT4.dll 1576, Setup, C: \ Windows \ system32
Frequently asked Interview Questions in ADO.Net hi friends Any one send frequently asked Important questions in C# .Net, ADO .Net, Asp .Net and Sql Server. . . . . . . . tx in Advance. . . . . . Hi, Find this. . (B)What is an IL? (B COM? (A)How can we use .NET components in COM? (A) How can we make Windows API calls in .NET? (B) When we use windows API in .NET is it managed or unmanaged code? (I)What is COM? (A) What
want to be a .net developer • To test a Web Service you must create a windows application or web application to consume this service? It is True / False? FALSE How many a single.NET DLL contain? Answer1: As many Answer2: One or more What are good ADO.NET object(s) to replace the ADO Recordset object? The differences includes In ADO, the in-memory representation of data is the recordset. In ADO.net, it is the dataset A recordset looks like a single table in ADO In contrast a dataset is a collection of one or more tables in ADO.net ADO is designed primarily for connected access ADO.net the disconnected access to the database is used In ADO you communicate with the