Wednesday, 14 December 2011

Differences Between WCF And ASMX Services in .net


Differences:
The differences (conceptual) between WCF and ASMX Services can he highlighted by several items, but we will discuss the 2 largest.
Protocols Support for WCF Service
WCF
  • HTTP
  • TCP
  • Named Pipes
  • MSMQ
  • Custom
  • UDP
Protocols Support for ASMX Web Service)
ASMX:
HTTP only
Hosting:
ASMX: Can be hosted only with HttpRuntime in IIS
WCF: A WCF component can be hosted in any environment in .NET 3.0 such as a console application, Windows applications, of even IIS
WCF Servces can be hosted outside of a IIS web server
Ok we’re looked at the overall differences between ASMX Web Services and WCF Services, so now let look at some major advantages of a WCF service and an ASMX Web Service:
  • Multiple Protocols:
    WCF can work across multiple protocols like HTTP,TCP, MSMQ, etc while ASMX services can use just one, HTTP
  • Better Interoperability:
    WCF is interoperable with other systems, compared to .Net Remoting where the client and service have to be .Net.
  • Logging:
    WCF has a built-in logging system. Simply changing the config file settings provides loging functionality. In ASMX the programmer as to write their own.
  • Transactions:
  • WCF can create, and maintain, transactions like COM+
  • Exeptions:
    In ASMX unhandled exceptions are returned to the client (browser, user, etc) as SOAP faults, which WCF does not return then as SOAP faults
Limitations of ASMX:
  • An ASMX page doesnt vital information such as what type of security to use or how to deliver.
  • ASMX is tightly coupled with the HTTP runtime, in face it’s so tight with it it’s dependant on IIS to host it.
  • ASMX services are instantiated on a per-call basis only.
  • ASMX does provide the way for interoperability but with that theres no guaranteed end-to-end security or even reliable communication (which is its job).
Advantages of WCF:
  • Unlike ASMX WCF lets you chose the delivery tyoe and type of security, just a minor tweak to the config file is all thats needed.
  • A WCF Service can be hosted by any Windows process, as long as it can host .NET Framework 3.0.
  • WCF gives you the flexibility on how the service is instantiated such as Singleton, provate session, or per call (which is the only one ASMX offers).
  • Not only is WCF interoperable but it also offers end-to-end reliability and security
One more think t

No comments:

Post a Comment