Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between the Visual Studio Options: ASP.NET Web Service and WCF Service

I see that there are two options that I know can be used in web services... WCF obviously, and ASP.NET Web Services. What's the difference? I just started picking up WCF recently and had a little exposure to web services in the past, but I'm certainly not an expert.

like image 386
MedicineMan Avatar asked Jan 24 '23 16:01

MedicineMan


1 Answers

it is quite easy to know the differences.

ASP.NET Web Method is called ASMX [because of the file extension] (check 4GuysFromRolla about this, they have a good tutorial)

This technology makes you expose methods as a Web Service so you can connect it (to the WS) from everywhere and use it (the methods). But... you can't protect the data between server and client, like, you can send big files in a clear mode, etc...

[Note] you can protect the access to the web service using certificates, but it is a pain and quite complicated, normally in ASMX we use username / passsword to give access to a method (once again... in plain text!)

In WCF, you are in the different world about Web Services, and this is the best technology in .NET (so far) to expose Services (can you see the difference... Services! not Web Services), WCF does not need IIS to run, it can run as a System Service on the server, using a console ambient (like command line), in TCP/IP mode, etc, so we say that WCF is a Service, not a Web Service. Remember ASMX need IIS to run and will only run hosted in a Web Server.

With WCF you can use SSL to encrypt the communication (to do that in ASMX you need to use WSE - Web Services Enhancements) and it is quite easy to implement it, you can send big files and securely (to do that in ASMX you need to use MTOM - Message Transmission Optimization Mechanism).

you can set the transmission preferences just changing one line of code, or even, if you prefer, change the XML configuration file, the security is much higher, etc, etc :)

hope you get a better general overview with this, but there is much more.

bottom line: to expose Web Services that you do not need to protect, you can use ASMX, no problem at all, but if you need to protect the communication somehow, do it in WCF!

link: you can read here some performance comparative between the 2 services

like image 158
balexandre Avatar answered Feb 15 '23 16:02

balexandre