Need a Translation?

Differentiate between WCF and ASMX Web Service

  • ASMX Web Services (ASP.NET Web Service) are designed to exchange messages only using SOAP over HTTP.
    However, WCF can exchange messages using any format (SOAP is the default format) over any transport protocol (HTTP, TCP/IP, MSMQ, NamedPipes, etc).
  • ASMX Web Services can only be hosted in IIS over HTTP.
    However, WCF service can be hosted in IIS, WAS (Windows Process Activation Services), Console Application, Windows NT Services, WCF provided host.
  • There is limited security in ASMX Web Services. IIS is responsible for authentication and authorization and ASP.NET security configuration, and transport layer security. WSE can be used for message layer security.
    WCF supports many of the capabilities provided by IIS and WS-* security models. It provides a consistent security programming model for any protocol. The security provided by WCF is consistent regardless of the host that is used to implement the service. WCF also supports claim based authorization, that provides much better control over resources than role based security.
  • ASMX Web Services uses XmlSerializer for serialization while WCF uses DataContractSerializer which is far better in performance than XmlSerializer. Major issues with XmlSerializer is as given below:
    a) Only public fields or properties can be translated to XML.
    b) The classes which implements IEnumerable interface can only be translated.
    c) Classes that implement IDictionary such as Hashtable cannot be serialized.
  • Web Services are not as flexible as WCF services. If you make a new version of the service then you need to just expose a new end. Therefore, services are agile and which is a very practical approach looking at the current business trends.

    Note: WebService supports Early Binding while WCF supports Late Binding.

    A major advantage of WCF over WebServices is that it can exchange messages in the following patterns:

    1)    Request – Reply Message Exchange Pattern
    2)    One – Way Message Exchange Pattern
    3)    Duplex Message Exchange Pattern

    WebServices only supports Request – Reply Message Exchange Pattern.

No comments:

Post a Comment