Tuesday, August 19, 2014

Difference between Webservice and WCF Service



C#.net : Difference between Webservice and WCF Service
What is the difference between webservice and wcf service? is a very common question in almost every interviews. This is one of the most important topic because programmer should know when to use asp.net web service and when to use wcf service. We should know what is webservice and what is wcf? In other article i have already explained about web service and what is wcf service. The summary of the two is given below.

What is Webservice?

According to web definition from WIKI –
“…A web service is a method of communication between two electronic devices over World Wide Web. It is a software function provided at a network address over the web with the service always on as in the concept of utility computing.”
Web service is a mechanism that provides data as a service/response over the http protocol on request of some other programs.

What is WCF service?

Windows Communication Foundation (WCF) is a often use to develope and deploy network distributed services based on the principles of Service Oriented Architecture (SOA). The fundamental characteristic of WCF is Interoperability. This gives you more manageable approach to create and consume web services.
From the previous posts, we learn to create a WCF service, consume wcf service, self-host wcf service and other various activities.

C#.Net – Web Service Vs WCF service
In this c# tutorial we are going to see the difference between ASP.net web service and WCF service. The table below shows the difference between webservice and wcf. By the end of this article i believe you will completely familier with webservice vs wcf service.

Difference between Webservice and WCF service

Sr. No Features ASP.net Web Service WCF Service
1 File Format/Extension ASP.net web services uses .asmx as a file extension. WCF web service uses .svc as a file extension.
2 Hosting ASP.net Web service can be hosted in IIS. As well as ASP.net WebService can be hosted outside of IIS like ASP.net web service can be hosted in a Windows Service. WCF service is flexible because it can be hosted in IIS, Windows Activation Services(WAS), Managed Windows Services and It also supports Self-Hosting.
3 Transport Protocols/Binding ASP.net Web service supports HTTP & TCP protocols along with custom binding. WCF service supports HTTP, WS-HTTP, TCP, Custom, Named Pipes, MSMQ & P2P(Point to Point) etc.
4 Data Transformation It uses XML serializer for Data Transformation. WCF service uses DataContractSerializer for Data Transformation.
5 Serialization NameSpace System.XML.Serialization System.RunTime.Serialization
6 Supported Operations The supported operations are only One-Way and Request-Response type. The supported operations includes One-Way, Request-Response and Duplex.
7 Encoding It uses following encoding mechanisms -
XML1.0, MTOM (Message Transmission Optimization Mechanism), DIME (Direct Internet Message Encapsulation)
It uses following encoding mechanisms -
XML1.0, MTOM, Binary
8 WebMethods and DataContract Uses WebMethods to translate .Net FW types in to XML.
  • [WebService] attribute has to be added to into the class.
  • [WebMethod] attribute represents the method exposed to the client.
Uses DataContractAttributes and DataMemberAttribute to translate .Net FW types in to XML.
  • [ServiceContract] attribute has to be added to into the class.
  • [OperationContract] attribute represents the method exposed to the client.
9 Messaging Asp.Net web service supports only SOAP(Simple Object Access Protocol) as messaging service. WCF service can send/receive message through any transport protocol message format. However, by default it uses SOAP for communication.
10 Security This is not much secured as compared to WCF. It is less secured to protect data between Server and Client. Certificates can protect the data but it is very complicated to use Certificates. For security, normally we use UserName/Password. As compared to ASP.net web service, WCF services are more secured. WCF does not need IIS to run, it can run as a System Service on the Server, using a command ambient. We can say that WCF is a service and not a Web Service.
11 Performance Performance wise web services are slower than WCF service. WCF services are than WebService. The performance measures in terms of xml serialization.
12 Exception Handling This returns all unhandled exceptions to the client as SOAP faults. WCF does not returns unhandled Exceptions to the client as SOAP faults. A configuration setting is provided to have the unhandled exceptions returned to the Client for the purpose of debugging.
13 Limitations
  • Hash Table cannot be serialized.
  • Only public properties/fields can be serialized
  • The DataContractSerializer translate the Hash table into the XML.
  • Public/Private properties/fields can be serialized.
I hope you enjoyed the article that explains the difference between webservice and wcf. If you find this article helpful, then could you please share the article on your social media?
Following articles might be of your interest

5 comments:

  1. Nowadays, gambling occurs joker123 free repeatedly, and anything in daily moving picture is proposed as a gambling game. Some people gone gambling, even if others are scared of gambling and have a negative attitude towards gambling

    ReplyDelete
  2. Proving that this is uncharacteristic is entirely not subsequently the long admission experience elsewhere. You can be certain that all steps will be ended correctly. For those
    online casino private who when to play up the fun of veracity betting, don't miss the knee to connect us. make clear you are not disappointed.
    https://fredmcollins.doodlekit.com/home

    ReplyDelete
  3. This betting technique allows players to divide their bets into several piles. Each chip is equal, it is recommended to spend at least 800 baht, not speaking into 8 equal chips, 100 baht per pile, and after that casino royale eva green choose to bet 100 baht per round, and a refund will be made later than betting. The gain is 100 baht and the cost is 200 baht. In the adjacent round of betting, the artiste will bet unusual 200 baht. If it is placed correctly, 400 baht will be refunded and then betting of 100 baht. The indigenous principle of this type of betting is the hem. If you lose the bet, you continue to area bets of approximately 100 baht until you win the bet. After that, bet and bet according to the formula. The advantage of this technique is that bettors can area complex bets based on their budget. If you bet correctly according to the formula at least 2 times, there is more or less no loss.

    ReplyDelete
  4. Tyrannosaurus Rex is a parable of wildness. It can replace various symbols in just about all games except skaters themselves. This is an supreme giveaway game. Now you can get a lot of help from special symbols. Whenever you rotate, this means there will be infinite triggers. It has been a diversified game before the reggae slot robot was made, therefore casino royale cast 1954 players compulsion to be long-suffering in finding worthy wins. Takes you to No. 3 in the ad slot suggested by Net Ent creators today, giving you a game that can gate your destiny. The game comes in the manner of 5 rolls, 4 rolls, 40 pay lines and 96.24% RTP. However, past you start spinning the game, it is recommended that you set the betting range, name, and chip size, which should be along with 0.01-1, and the number of chips per pedigree can be set to 1-10.

    ReplyDelete