我无法在远程调用wcf服务。我在不同的域有wcf服务。
以下是代码:
WCF功能:
public Customer GetStringName()
{
return new Customer() { Name = "Pranay", Address = "1 Ahmedabad" };
}
客户来电:
$.ajax({
type: "GET",
url: "http://124.301.114.83/WCFServicevana/Service.svc/getstringName",
contentType: "application/json",
DataType: 'jsonp',
ProcessData: false,
data: "",
success: function (result) {
resultObject = result.getdata;
var string = result.Name + " : " + result.Address;
alert(string);
},
error: function (textStatus) {
alert(textStatus);
}
});
})
});
的crossdomain.xml
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<allow-http-request-headers-from domain="*" headers="*"/>
</cross-domain-policy>
clientaccesspolicy.xml
<?xml version="1.0" encoding="utf-8"?>
<access-policy>
<cross-domain-access>
<policy>
<allow-from http-request-headers="*">
<domain uri="*"/>
</allow-from>
<grant-to>
<resource path="/" include-subpaths="true"/>
</grant-to>
</policy>
</cross-domain-access>
</access-policy>
我写了上面的编码...但我没有得到结果。我得到了空洞的结果。
任何人都会帮助我。
提前致谢。