0
我有寧靜的網絡服務。一個應用程序android客戶端通過ajax調用restful web服務。我不知道模擬器android的IP地址和端口,因此註冊一個客戶端地址訪問寧靜的web服務。 Plz幫助我。在應用程序的Android如何知道模擬器android的端口號?
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();
}