web服务和使用ajax调用代码隐藏之间的区别是什么?

时间:2021-08-13 15:50:51

Is there any difference in using one over the other?

两者之间使用有什么区别吗?

Should I be retrieving data from a database using web services? Or is it better to call methods from code-behind (or somewhere similar) with ajax to retrieve data?

我应该使用web服务从数据库中检索数据吗?还是用ajax从代码隐藏(或类似的地方)调用方法来检索数据更好?

2 个解决方案

#1


1  

When you say "calling methods from codebehind", what are you referring to? Do you mean "page methods"? Those are web services, just limited ones.

当你说“从代码后调用方法”时,你指的是什么?你是说“页面方法”吗?这些是web服务,只是有限的服务。

#2


1  

A lot of times, when someone says "Web services", they mean SOAP compliant web services. If they do, then there are a lot of differences. If they just mean a service with an HTTP interface, then calling code-behind meets that requirement.

很多时候,当有人说“Web服务”时,他们指的是兼容SOAP的Web服务。如果他们这样做了,那么就会有很多不同。如果它们只是指具有HTTP接口的服务,那么调用代码隐藏满足这个需求。

The main difference that you might care about is SOAP is a cross-language/cross-platform standard that other kinds of frameworks provide support for. So, if you mean to expose your service to other clients (aside from yourself), it might be easier for them to consume. It isn't the only choice -- you could just define a simple REST-based style service.

您可能关心的主要区别是SOAP是一种跨语言/跨平台的标准,其他类型的框架提供支持。因此,如果您打算将服务公开给其他客户(除了您自己),那么他们可能更容易消费。它不是唯一的选择——您可以定义一个简单的基于rest的样式服务。

Calling Page-methods via some ASP.NET only mechanism would be hard for other clients, if you care.

通过一些ASP调用页面方法。如果您关心的话,NET only机制对其他客户来说是很难实现的。

#1


1  

When you say "calling methods from codebehind", what are you referring to? Do you mean "page methods"? Those are web services, just limited ones.

当你说“从代码后调用方法”时,你指的是什么?你是说“页面方法”吗?这些是web服务,只是有限的服务。

#2


1  

A lot of times, when someone says "Web services", they mean SOAP compliant web services. If they do, then there are a lot of differences. If they just mean a service with an HTTP interface, then calling code-behind meets that requirement.

很多时候,当有人说“Web服务”时,他们指的是兼容SOAP的Web服务。如果他们这样做了,那么就会有很多不同。如果它们只是指具有HTTP接口的服务,那么调用代码隐藏满足这个需求。

The main difference that you might care about is SOAP is a cross-language/cross-platform standard that other kinds of frameworks provide support for. So, if you mean to expose your service to other clients (aside from yourself), it might be easier for them to consume. It isn't the only choice -- you could just define a simple REST-based style service.

您可能关心的主要区别是SOAP是一种跨语言/跨平台的标准,其他类型的框架提供支持。因此,如果您打算将服务公开给其他客户(除了您自己),那么他们可能更容易消费。它不是唯一的选择——您可以定义一个简单的基于rest的样式服务。

Calling Page-methods via some ASP.NET only mechanism would be hard for other clients, if you care.

通过一些ASP调用页面方法。如果您关心的话,NET only机制对其他客户来说是很难实现的。