我有restful web服务。android客户端通过ajax调用restful风格的web服务。我不知道模拟器android的IP地址和端口,所以注册一个客户端地址访问restful风格的web服务。请帮帮我。
在android应用程序中编写ajax代码
function Get() {
$.ajax({
url: "http://<web service domain>:31132/api/Customer",
type: "GET",
dataType: "json",
contentType: "application/json;charset=utf-8",
success: function (data) {
$('#d').append("success");
},
error:function(){
$('#d').append("Errorrr");
}
});
}restful风格的web服务中的代码注册客户端地址
公共静态空RegisterCors(HttpConfiguration httpConfig) {
WebApiCorsConfiguration corsConfig = new WebApiCorsConfiguration();
corsConfig.RegisterGlobal(httpConfig);
corsConfig
.ForResources("Customer")
.ForOrigins("?????")// we need to register a client address access to webservice.This is my problem.
.AllowAll();
}发布于 2013-02-20 00:26:03
adb shell ifconfig tiwlan0tiwlan0是设备上wi-fi网络接口的名称
https://stackoverflow.com/questions/14961661
复制相似问题