【发布时间】:2017-01-18 22:23:39
【问题描述】:
var client = new HttpClient();
client.DefaultRequestHeaders.Add("x-ms-version", "2016-05-31");
var content = new FormUrlEncodedContent(new KeyValuePair<string, string>[]
{
new KeyValuePair<string, string>("api-version", "2016-08-01")
});
content.Headers.ContentType = new MediaTypeHeaderValue("application/xml");
var response = client.PostAsync("https://management.azure.com/subscriptions/SuscriptionID/resourceGroups/Default-Web-SoutheastAsia/providers/Microsoft.Web/sites/MyAppName/stop?", content);
这是我调用 Azure WebApp rest api 的方式,但我得到了状态码:BadRequest
【问题讨论】:
-
您也应该阅读回复,它会告诉您更多信息。
-
而且你的内容类型肯定不是 application/xml,它是
application/x-www-form-urlencoded。也许您想改为设置 Accept 标头?
标签: azure azure-app-service-envrmnt