简体   繁体   English

如何从.NET 4.0中的JS调用服务器方法

[英]How to call server methods from JS in .NET 4.0

I am going to implement some WCF service and call it from JavaScript. 我将实现一些WCF服务并从JavaScript调用它。 Here is explanation, how I am going to do that: http://msdn.microsoft.com/en-us/magazine/cc163499.aspx 这是解释,我将如何做: http : //msdn.microsoft.com/zh-cn/magazine/cc163499.aspx

Is there anything better in ASP.NET 4.0 that has some additional benefits (linked article works with asp.net 2.0 only)? ASP.NET 4.0中还有什么更好的东西可以带来一些额外的好处(链接文章仅适用于asp.net 2.0)吗?

Thanks a lot. 非常感谢。

That article you mentioned is about consuming an asmx service not WCF. 您提到的那篇文章是关于使用asmx服务而不是WCF。

WCF is the new kid on the block, you should use it. WCF是新手,您应该使用它。 With WCF the advantage is you can return Json (among other options) 使用WCF的好处是您可以返回Json(在其他选项中)

Here are some links on using WCF services with javascript/JQuery: 以下是将WCF服务与javascript / JQuery结合使用的一些链接:

http://dotnetbyexample.blogspot.com/2008/02/calling-wcf-service-from-javascript.html http://dotnetbyexample.blogspot.com/2008/02/calling-wcf-service-from-javascript.html
http://www.west-wind.com/weblog/posts/324917.aspx http://www.west-wind.com/weblog/posts/324917.aspx

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM