在winRT上的https请求

时间:2015-04-20 15:33:10

标签: c# windows-runtime windows-phone-8.1

我需要发送此请求:

POST /params/initProvisioning HTTP/1.1
Host: serverIp:4443
Content-Type: application/json
Cache-Control: no-cache

{
    "mobileOS":"WindowsPhone",
    "pushId":"https://db3.notify.windows.com/?token=AwYAAAA...",
    "deviceType":"type"
}

当我使用PostMan工具发送它时,一切正常。但是当我从Windows Phone 8.1 app发送它时,我收到错误404:

StringBuilder sb = new StringBuilder();
sb.Append("{");
foreach (Parameter p in parameters)
    sb.Append(ParameterToJsonString(p));
sb.Append("}");
Debug.WriteLine("params to send : {0}", sb.ToString());

HttpClient httpClient = new HttpClient();
var response = await httpClient.PostAsync(new Uri("https://serverIp:4443/params/initProvisioning"),
    new StringContent(sb.ToString(), Encoding.UTF8, "application/json"));

response.EnsureSuccessStatusCode();

是否有https协议的特殊客户端?

0 个答案:

没有答案