![](/img/trans.png)
[英]“Cannot create an abstract class” error when converting API Method from .NET WebForms to .NET Web API
[英]Invalid PUT method from Webforms to Web API 2 (Azure)
我的Azure服務器中有一個Web API,並且正在從ASP.NET Webforms網站進行調用。
我似乎可以輕松執行GET。 現在,對於PUT,它給了我這個錯誤:
您正在尋找的頁面無法顯示,因為正在使用無效的方法(HTTP動詞)
我也無法刪除。 我看到其他一些主題,人們可以在其中禁用某些WebDav和IIS服務器上的內容,並且可以使用。 但是在Azure上嗎?
在我的PUT代碼下面:
HttpResponseMessage response = client.GetAsync("api/People/" + id).Result;
if (response.IsSuccessStatusCode)
{
var yourcustomobjects = response.Content.ReadAsAsync<People>().Result;
Uri peopleUrl = response.Headers.Location;
yourcustomobjects.name= "Bob";
response = await client.PutAsJsonAsync(peopleUrl, yourcustomobjects);
tbDebug.Text += await response.Content.ReadAsStringAsync();
}
好吧,我厭倦了嘗試通過啟用PUT解決此問題。
因此,我所做的就是寫了一個GET,可以對數據庫進行必要的更改。
干杯
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.