0

我有宁静的网络服务。一个应用 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();

    }
4

1 回答 1

0
adb shell ifconfig tiwlan0

tiwlan0 是设备上 wi-fi 网络接口的名称

于 2013-02-19T16:26:02.883 回答