Get WCF REST GET request in Android

When I call my WCF service using the andoroid volley library, you throw a TimeOut Exception. This is my code. What is the error of this code.

RequestQueue queue = Volley.newRequestQueue(getApplicationContext()); String URL = "http://192.168.42.200:10963/DisasterService.svc/type/findDisType"; JsonObjectRequest jsonObjectRequest = new JsonObjectRequest(Request.Method.GET, URL, null, new Response.Listener<JSONObject>() { @Override public void onResponse(JSONObject response) { try { Toast.makeText(getApplicationContext(),"Ok",Toast.LENGTH_SHORT).show(); Toast.makeText(getApplicationContext(),response.toString(),Toast.LENGTH_SHORT).show(); } catch (Exception e) { Toast.makeText(getApplicationContext(),e.toString(),Toast.LENGTH_SHORT).show(); } } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { Toast.makeText(getApplicationContext(),error.toString(),Toast.LENGTH_SHORT).show(); } }); jsonObjectRequest.setRetryPolicy(new DefaultRetryPolicy(30000, 1, DefaultRetryPolicy.DEFAULT_BACKOFF_MULT)); queue.add(jsonObjectRequest); 

WCF Service Endpoint

  <service name="DisasterServices.DisasterService" behaviorConfiguration="DisasterServices_Behavior"> <endpoint address="area" binding="webHttpBinding" contract="DisasterServices.IAreaService"></endpoint> <endpoint address="type" binding="webHttpBinding" contract="DisasterServices.IDisasterTypeService"></endpoint> <endpoint address="suggestion" binding="webHttpBinding" contract="DisasterServices.ISuggestion"></endpoint> <endpoint address="user" binding="webHttpBinding" contract="DisasterServices.Iuser"></endpoint> <endpoint address="alerts" binding="webHttpBinding" contract="DisasterServices.IUserAlerts"></endpoint> </service> 

Interface - IDisasterTypeService
Method must be called - GetAllDisasterType

0
source share
1 answer

I found a solution for this. I added a binding to the applicationhost.config file on the IIS server.

 <site name="myservice" id="5"> <application path="/" applicationPool="Clr4IntegratedAppPool"> <virtualDirectory path="/" physicalPath="E:\vs\myservice" /> </application> <bindings> <binding protocol="http" bindingInformation="*:10963:127.0.0.1" /> <binding protocol="http" bindingInformation="*:8085:127.0.0.1" /> <binding protocol="http" bindingInformation="*:8085:192.168.42.200" /> </bindings> 

Then I installed the iis proxy and changed the port to proxy

 npm install -g iisexpress-proxy iisexpress-proxy 10963 to 8085 

10963 is the port that is starting up, and 8085 is the proxy port

Final I changed my URL in the Android app.

 String URL = "http://192.168.42.200:8085/myservice.svc/test/2"; 

Additional Information

0
source

All Articles