WCF/ASP.Net Web Services are used for developing web services. Here is a list of differentiation between these two.
After you know the importance of the WCF on Webservices, to create and explore on your first WCF application
Feature | ASP.NET Web Service | WCF |
Data Transformation | To and from Data Transition is done through XML Serializer | DataContractSerializer is used for data transition |
File Extension | File extention is asmx | File extension is .svc |
Webmethods vs DataContract Attributes | ASP.NET WebService uses Webmethods to to translate .NET FW types in to XML. | The WCF uses the DataContractAttribute and DataMemeberAttribute to translate .NET FW types in to XML. |
Limitations | Only Public fields or Properties of .NET types can be translated into XML.Only the classes which implement IEnumerable interface. ICollection interface can be serializable | Public/Private fields or properties of .NET types can be translated. |
IDictionary Interface class | Classes that implement the IDictionary interface, such as Hash table can not be serialized. | The DataContractSerializer can translate the Hash Table into XML. Hence using WCF we can even translate HashTable into XML |
Performance | Slower compared to WCF | The main benifit of the design of the DataContractSerializer is better performance over XML serialization |
Know which fields /properties | XMLSerialization does not indicate the which fields or properties of the type are serialized into XML | DataCotratSerializer Explicitly shows the which fields or properties are serialized into XML |
Exception handling | In ASP.NET Web services, Unhandled exceptions are returned to the client as SOAP faults. | In WCF Services, unhandled exceptions are not returned to clients as SOAP faults. A configuration setting is provided to have the unhandled exceptions returned to clients for the purpose of debugging. |
Example | [WebService] public class Service : System.Web.Services.WebService { [WebMethod] public string Demo(string strDemog) { return strDemo; } } | [ServiceContract] public interface ITest { [OperationContract] string ShowMessage(string strDemo); } public class Service : ITest { public string Demo(string strDemo) { return strDemo; } } |
After you know the importance of the WCF on Webservices, to create and explore on your first WCF application
No comments:
Post a Comment