WCF Tutorial | Difference between WCF and Web service
Difference between WCF and Web service
Web service is a part of WCF. WCF offers much more flexibility and portability to develop a service when comparing to web service. Still we are having more advantages over Web service, following table provides detailed difference between them.
||It can be hosted in IIS
||It can be hosted in IIS, windows activation service, Self-hosting, Windows service
||[WebService] attribute has to be added to the class
||[ServiceContraact] attribute has to be added to the class
||[WebMethod] attribute represents the method exposed to client
||[OperationContract] attribute represents the method exposed to client
||One-way, Request- Response are the different operations supported in web service
||One-Way, Request-Response, Duplex are different type of operations supported in WCF
||System.Xml.serialization name space is used for serialization
||System.Runtime.Serialization namespace is used for serialization
||XML 1.0, MTOM(Message Transmission Optimization Mechanism), DIME, Custom
||XML 1.0, MTOM, Binary, Custom
||Can be accessed through HTTP, TCP, Custom
||Can be accessed through HTTP, TCP, Named pipes, MSMQ,P2P, Custom
||Security, Reliable messaging, Transactions
Comments on this article
- Always create the service with Interface->Implementation format, mention the contract in Interface.
- Define the service in Class library and refer the class library in Host project. Donâ€™t use service class in host project.
- Change the instance mode to per call as default.
- Always catch exception using try/catch block and throw exception using FaultException < T >.
- Logging and Include exception should be enable while compiling the project in debug mode. While in production deployment disable the logging and Include exception details.