HttpClient SendAsync没有返回错误或数据

时间:2013-11-04 21:49:57

标签: dotnet-httpclient

  var client = new HttpClient();

            HttpRequestMessage httpRequestMessage = new HttpRequestMessage
            {
                Method = HttpMethod.Post,
                RequestUri = new Uri("https://api.stubhubsandbox.com/login"),

            };

            httpRequestMessage.Headers.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("text/html"));
            httpRequestMessage.Headers.Add("Host", "api.stubhubsandbox.com");
            httpRequestMessage.Content = new StringContent(finalParameters);

            httpRequestMessage.Content.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue(ContentType);
            httpRequestMessage.Content.Headers.ContentLength = 80;
            httpRequestMessage.Headers.Add("Authorization", Authorization);


            Console.WriteLine(httpRequestMessage.ToString());

            var response = client.SendAsync(httpRequestMessage).ContinueWith(respTask =>
            {
                Console.WriteLine("Response: {0}", respTask.Result);
            });

            Console.ReadLine();

我的小提琴打开,我没有看到我的请求已被发送。它没有返回或抛出任何例外? 看起来我不能通过https调用我的电话?

0 个答案:

没有答案