从远程服务器调用WCF JSON服务 [英] Calling WCF JSON service from remote server
问题描述
大家好,
我正试图从crome和safari浏览器远程服务器URL访问wcf JSON类型服务,但是我收到一条错误消息。以下是代码
Hi All,
I am trying to access the wcf JSON type service from remote server url from crome and safari browsers, but I am getting an error message. Following is the code
var jsonText2=JSON.stringify({"FirstName": "Avinash","LastName": "Patil"});
$.ajax({
type:"POST",
url:"http://192.168.2.56/AndroidWcfService/Service1.svc/UserRegistration",
data:jsonText2,
contentType:"application/json;charset=utf-8",
dataType:"jsonp",
timeout: 1000*60*15,
success:function(data )
{
alert("inside success");
//alert(data.loginResponse+" ");
if(data)
{
//InsertDeviceInformation();
alert("Success");
}
},
error:function(error){
alert("checkNWCon");
}
});
如果我使用本地托管的服务然后它工作正常并给出成功的结果。
从远程服务器拨打服务需要进行哪些更改!!!!
请尽快建议。
感谢您的建议
--Avinash
If I used the locally hosted service then it is working fine and giving the success results.
What are the changes need to call service from remote server!!!!
Please suggest ASAP.
Thanks for suggestions
--Avinash
推荐答案
.ajax({
type:POST,
url:http://192.168.2.56/AndroidWcfService/Service1.svc/UserRegistration,
data:jsonText2 ,
contentType:application / json; charset = utf-8,
dataType:jsonp,
timeout:1000 * 60 * 15,
success:function(data )
{
alert(内部成功);
//alert(data.loginResponse+);
if(data)
{
// InsertDeviceInformation();
alert(成功);
}
},
错误:函数(错误){
alert( checkNWCon);
}
});
.ajax({ type:"POST", url:"http://192.168.2.56/AndroidWcfService/Service1.svc/UserRegistration", data:jsonText2, contentType:"application/json;charset=utf-8", dataType:"jsonp", timeout: 1000*60*15, success:function(data ) { alert("inside success"); //alert(data.loginResponse+" "); if(data) { //InsertDeviceInformation(); alert("Success"); } }, error:function(error){ alert("checkNWCon"); } });
如果我在本地使用托管服务,然后它工作正常,并给出成功的结果。
从远程服务器拨打服务需要进行哪些更改!!!!
请尽快建议。
感谢您的建议
--Avinash
If I used the locally hosted service then it is working fine and giving the success results.
What are the changes need to call service from remote server!!!!
Please suggest ASAP.
Thanks for suggestions
--Avinash
应该如果你也提到了错误,那就更好了。
检查你是否正确配置了防火墙。在防火墙部分,在例外选项卡中添加程序或应用程序。如果默认端口已被其他应用程序占用,请确保选择端口并进行分配。
Should have been better if you have had mentioned the error too.
Check if you have configured the Firewall properly. In the firewall section, add "Program" or application in the "Exception" tab. Also make sure you select a "Port" and assign it, if the default port is already taken by another application.
这篇关于从远程服务器调用WCF JSON服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!