title: C# httpclient with Task<string> that return content
body: <p>I've the following function but can't debug it because response never come. Service on the other side is working. Any help will be preciated, I can't deduce how must be do it with other answers in SO</p>
  
  <pre><code>    public async Task&lt;string&gt; PostObjectToWebServiceAsJSON(object objectToPost, string validatorName, string method)
      {
          using (var client = new HttpClient())
          {
              client.BaseAddress = new Uri("myuri" + "/" + method);
              client.DefaultRequestHeaders.Accept.Clear();
              client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
              // HTTP POST
              var response = await client.PostAsJsonAsync("", objectToPost);
              if (response.IsSuccessStatusCode)
              {
                  return await response.Content.ReadAsStringAsync();
              }
              else
              {
                  string errplugin = "Error";
  
                  return null;
              }
          }
      }
  </code></pre>
  
  <p>This is how I call it:</p>
  
  <pre><code>    public PaymentResponseInternal Post(some stuff here)
      {
          Task&lt;string&gt; retornoPluginAsync = PostObjectToWebServiceAsJSON(some stuff here);
  
          retornoPluginAsync.Wait();
          string result = retornoPluginAsync.Result;
  
          return JsonConvert.DeserializeObject&lt;PaymentResponseInternal&gt;(result);
      }
  </code></pre>