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的Web應用程序REST API的調用,但我得到的StatusCode:錯誤請求400錯誤請求而蔚藍的Web呼叫REST API應用
你也應該閱讀迴應,它會告訴你更多。 – juunas
而你的內容類型肯定不是application/xml,它是'application/x-www-form-urlencoded'。也許你想要設置Accept頭? – juunas