[英]Service that can be accessed by both client-side (jquery) and server-side (asp.net) applications
Problem Statement: A service that can be accessed by both client-side (jquery) and server-side (asp.net) applications. 问题陈述:客户端(jquery)和服务器端(asp.net)应用程序都可以访问的服务。 All the applications are internal apps.
所有应用程序都是内部应用程序。 Note: Preferrable format of communication is JSON
注意:首选的通信格式是JSON
Description: 描述:
I need to expose a persistent store (database) through a service which provides CRUD operations. 我需要通过提供CRUD操作的服务公开持久存储(数据库)。 The service needs to be accessible from both client-side applications via jquery and server-side applications such as asp.net webapplications.
需要通过jquery从客户端应用程序和服务器端应用程序(如asp.net Web应用程序)访问该服务。
From my initial research, I realized that if I go with asp.net ajax asmx (or) ajax enabled wcf service, I will not be able to use this in other applications due to cross-domain / cross-scripting issues (ref: calling asmx web service from jQuery ). 从最初的研究中,我意识到,如果我使用启用了asp.net ajax asmx(或支持ajax的wcf服务),由于跨域/跨脚本问题(参考: 调用 ),我将无法在其他应用程序中使用此功能。 jQuery的asmx Web服务 )。
I saw workarounds using JSONP but my understanding is that only get requests are supported and its a hacky either way. 我看到了使用JSONP的解决方法,但是我的理解是仅支持请求获取,并且这两种方法都是很棘手的。
I think I'm all over the place. 我想我到处都是。 Here are some of the links I went through :
这是我经历过的一些链接:
http://forums.asp.net/p/1512786/3609834.aspx http://forums.asp.net/p/1512786/3609834.aspx
How to call external webservice using jquery "jsonp"? 如何使用jquery“ jsonp”调用外部Web服务?
can jquery ajax call external webservice? jQuery Ajax可以调用外部Web服务吗?
What is the best way to call a .net webservice using jquery? 使用jquery调用.net Web服务的最佳方法是什么?
What are some good examples of JQuery using JSONP talking to .net? 使用JSONP与.net进行通讯的JQuery的一些好示例是什么?
http://msdn.microsoft.com/en-us/library/cc716898.aspx http://msdn.microsoft.com/en-us/library/cc716898.aspx
http://www.west-wind.com/Weblog/posts/107136.aspx http://www.west-wind.com/Weblog/posts/107136.aspx
http://abcoder.com/javascript/jquery/jsonp-first-timer/ http://abcoder.com/javascript/jquery/jsonp-first-timer/
Post data to JsonP 将数据发布到JsonP
http://donatstudios.com/JSONP http://donatstudios.com/JSONP
http://www.4guysfromrolla.com/articles/111710-1.aspx http://www.4guysfromrolla.com/articles/111710-1.aspx
I'm going towards a self-hosted WCF Restful service that deals with JSON. 我正朝着处理JSON的自托管WCF Restful服务迈进。 Is this a viable options ?
这是可行的选择吗? Any issues with Restful WCF Service ?
Restful WCF服务有任何问题吗? Any suggestions ?
有什么建议么 ?
Note: I'm using C# and .NET 3.5 SP1 注意:我正在使用C#和.NET 3.5 SP1
Please advise. 请指教。
If you host a web service, if on the same domain, you may be able to use JQuery to call it. 如果托管Web服务,并且位于同一域中,则可以使用JQuery对其进行调用。 The ScriptManager proxy approach does not work out of the box, but it's possible to do through the Sys.Net.WebServiceProxy class.
ScriptManager代理方法不是开箱即用的,但是可以通过Sys.Net.WebServiceProxy类来完成。 Otherwise, worst-case scenario is that you create your dedicated service, and have an ASMX or AJAX-enabled WCF service wrap it to provide you the generated proxy features and cross-domain calls.
否则,最坏的情况是您创建专用服务,并使用支持ASMX或AJAX的WCF服务对其进行包装,以为您提供生成的代理功能和跨域调用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.