Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
368 views
in Technique[技术] by (71.8m points)

asp.net - Difference between webservice, web methods & server side code?

Some questions confusing me guys, I'm just new to web services altogether.

  1. What is the difference between web service, web methods and server side code ?

  2. Where is web service preferred over server side methods?

  3. Where are web methods preferred to be used ?

  4. How does web service differ from server side post back ?

  5. Are web services light weight ? Can they be used to save long web forms as well ?

  6. In an enterprise web application, which one of these should I use frequently and why?
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

What is the difference between web service, web methods and server side code ?

A web service is an exposed end point that is normally used as an API, or in other words its end user is typically another application rather than a user interface. A web method is a particular method that is exposed over a web service.

On the other hand, server-side code applies to any ASP.NET web page, web service, or other technology for general implementation of its functionality.

Where is web service preferred over server side methods?

Web services excel at making an application compatible with other programming platforms or for serving up AJAX requests to a web page. There are many other uses, but typically using WCF or HttpHandlers are better options in those cases.

Where are web methods preferred to be used ?

Web methods can be used in any .aspx page or more typically in a .asmx (web service) file.

How does web service differ from server side post back ?

A server-side postback occurs when a web page posts data to the server for processing. A web service is completely different - it is an endpoint that is exposed for consumption by another application (or within the same application).

Are web services light weight ? Can they be used to save long web forms as well ?

No, web services are not light weight, in fact they are quite the opposite because they generally receive and respond to data using XML (a bulky format). However, this makes them very easy to use with other programming languages.

In an enterprise web application, which one of these should I use frequently and why?

This is a highly subjective question. Each technology in the .NET framework has a set of features that it excels at and can usually do several other things (but not very well). Each tool has its place, it is just a matter of matching the tools to use with the requirements of your project.

However, judging by the rest of your questioning, it sounds like you are just putting together a typical website that doesn't require an API, in which case it would be best to use .aspx pages and code behind.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...