![](/img/trans.png)
[英]ASP.NET MVC ViewBag list of anonymous class throws error on Count() method
[英]Put method throws 500 error ASP.NET MVC 5
我在網站上使用的是REST API。 我正在使用PUT方法。
[HttpPut]
public ActionResult OrderChapter(ClientOrder order)
但是它不是Web API,而是MVC控制器。 起初,我收到405錯誤(不允許使用方法)。 Google說我需要刪除WebDAVModule
<system.webServer>
<modules>
<remove name="WebDAVModule" />
</modules>
在這之后,我有一個500錯誤。 這不是我的代碼。 添加此內容並沒有改變:
<handlers>
<remove name="ExtensionlessUrlHandler-Integrated-4.0" />
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE" type="System.Web.Handlers.TransferRequestHandler" resourceType="Unspecified" requireAccess="Script" preCondition="integratedMode,runtimeVersionv4.0" />
</handlers>
我的主持人說,沒有明確禁止PUT,PATCH和DELETE方法。
怎么了? 也許在IIS的設置中不允許使用此方法?
通常,錯誤代碼#500
與某些內部服務器錯誤有關,這也是它的正式定義。
用外行的話來說, PUT
操作中的代碼似乎有問題,快速調試PUT
操作方法將為您提供問題的答案,可能拋出了某些異常並將其翻譯為500錯誤代碼通過您的網絡服務器(例如IIS)。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.