title: Having trouble connecting to a web service with a windows 8.1 phone app
body: <p>This is my first time doing something like this so I'm probably going to sound stupid but here it goes.</p>
  
  <p>Here is my method that is supposed to connect to the web service.</p>
  
  <pre><code>public async void getWebData()
      {
          var uri = new Uri("http://localhost:9011/Service.svc?singleWsdl");
          var httpClient = new HttpClient();
  
          // Always catch network exceptions for async methods
          try
          {
              var result = await httpClient.GetStringAsync(uri);
  
              doSomething(result);
          }
          catch
          {
              // Details in ex.Message and ex.HResult.       
          }
  
          // Once your app is done using the HttpClient object call dispose to 
          // free up system resources (the underlying socket and memory used for the object)
          httpClient.Dispose();
      }
  </code></pre>
  
  <p>Here is my config info from the web.config file where I believe I added the rest endpoint correctly because I read that you have to use a rest endpoint to access web services in windows 8.1 phone apps.</p>
  
  <pre><code>&lt;bindings&gt;
    &lt;basicHttpBinding&gt;
      &lt;binding name="BasicHttpBinding_IService" /&gt;
    &lt;/basicHttpBinding&gt;
    &lt;webHttpBinding&gt;
      &lt;binding name="WebHttpBinding_IService" /&gt;
    &lt;/webHttpBinding&gt;
  &lt;/bindings&gt;
  &lt;services&gt;
    &lt;service name="WcfService.Service1" behaviorConfiguration="MyServiceBehavior"&gt;
      &lt;endpoint address="http://localhost:9011/Service.svc?singleWsdl" name="rest"
        binding="webHttpBinding" bindingConfiguration="WebHttpBinding_IService" contract="WcfService.IService" /&gt;
      &lt;endpoint address="http://localhost:9011/Service.svc?singleWsdl" name="soap"
        binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IService" contract="WcfService.IService" /&gt;
    &lt;/service&gt;
  &lt;/services&gt;
  &lt;behaviors&gt;
    &lt;serviceBehaviors&gt;
      &lt;behavior name="MyServiceBehavior"&gt;
        &lt;!-- To avoid disclosing metadata information, set the values below to false before deployment --&gt;
        &lt;serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/&gt;
        &lt;!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information --&gt;
        &lt;serviceDebug includeExceptionDetailInFaults="false"/&gt;
      &lt;/behavior&gt;
    &lt;/serviceBehaviors&gt;
    &lt;endpointBehaviors&gt;
      &lt;behavior name="jsonBehavior"&gt;
        &lt;enableWebScript/&gt;
      &lt;/behavior&gt;
    &lt;/endpointBehaviors&gt;
  &lt;/behaviors&gt;
  </code></pre>
  
  <p>So can anyone tell me what I'm doing wrong to access my webservice because nothing I try has been working...</p>