0
我用下面的代碼把數據給我的API:Put方法
using (var client = new HttpClient())
{
client.BaseAddress = new Uri(Baseurl);
client.DefaultRequestHeaders.Clear();
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
HttpResponseMessage response = client.PutAsJsonAsync($"/api/Home/UpdateEmpDetails/{id}", newEmployee).Result;
if (response.IsSuccessStatusCode)
{
//...
}
}
,但我得到了以下錯誤:
{StatusCode: 405, ReasonPhrase: 'Method Not Allowed', Version: 1.1, Content: System.Net.Http.StreamContent, Headers: { X-Powered-By-Plesk: PleskWin Connection: close Date: Thu, 05 Oct 2017 05:26:07 GMT Server: Microsoft-IIS/10.0 X-Powered-By: ASP.NET Content-Length: 1293 Allow: GET Allow: HEAD Allow: OPTIONS Allow: TRACE Content-Type: text/html }}
誰能幫助我?
我刪除了「WebDAV發佈」,但問題仍然剩餘。 – fateme