0

I have restful web service. An app android client call restful web service by ajax. I don't know IP address and port of emulator android so register a client address access to restful web service. Plz help me.

Code ajax in app 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");
            }
        });
    }

code register client address in restful web service

public static void 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();

    }
lqg
  • 1
  • 1

1 Answers1

0
adb shell ifconfig tiwlan0

tiwlan0 is the name of the wi-fi network interface on the device

Michael Reed
  • 2,362
  • 23
  • 15