c# - Having trouble connecting to a web service with a windows 8.1 phone app -
c# - Having trouble connecting to a web service with a windows 8.1 phone app -
this first time doing i'm going sound stupid here goes.
here method supposed connect web service.
public async void getwebdata() { var uri = new uri("http://localhost:9011/service.svc?singlewsdl"); var httpclient = new httpclient(); // grab network exceptions async methods seek { var result = await httpclient.getstringasync(uri); dosomething(result); } grab { // details in ex.message , ex.hresult. } // 1 time app done using httpclient object phone call dispose // free scheme resources (the underlying socket , memory used object) httpclient.dispose(); } here config info web.config file believe added rest endpoint correctly because read have utilize rest endpoint access web services in windows 8.1 phone apps.
<bindings> <basichttpbinding> <binding name="basichttpbinding_iservice" /> </basichttpbinding> <webhttpbinding> <binding name="webhttpbinding_iservice" /> </webhttpbinding> </bindings> <services> <service name="wcfservice.service1" behaviorconfiguration="myservicebehavior"> <endpoint address="http://localhost:9011/service.svc?singlewsdl" name="rest" binding="webhttpbinding" bindingconfiguration="webhttpbinding_iservice" contract="wcfservice.iservice" /> <endpoint address="http://localhost:9011/service.svc?singlewsdl" name="soap" binding="basichttpbinding" bindingconfiguration="basichttpbinding_iservice" contract="wcfservice.iservice" /> </service> </services> <behaviors> <servicebehaviors> <behavior name="myservicebehavior"> <!-- avoid disclosing metadata information, set values below false before deployment --> <servicemetadata httpgetenabled="true" httpsgetenabled="true"/> <!-- receive exception details in faults debugging purposes, set value below true. set false before deployment avoid disclosing exception info --> <servicedebug includeexceptiondetailinfaults="false"/> </behavior> </servicebehaviors> <endpointbehaviors> <behavior name="jsonbehavior"> <enablewebscript/> </behavior> </endpointbehaviors> </behaviors> so can tell me i'm doing wrong access webservice because nil seek has been working...
c# web-services windows-phone
Comments
Post a Comment