請求部署在 IIS7.5 上的 REST 服務的 Put/Post/Delete 操作發生 HTTP Error 405.0 - Method Not Allowed 錯誤之解決

來源:互聯網
上載者:User

標籤:sha   span   restful服務   ice   獨立   har   擴充模組   style   system   

背景

請求部署在 IIS7.5 上的 REST 服務的 Put/POST/DELETE 操作發生 HTTP Error 405.0 - Method Not Allowed 錯誤。

Issue

解決

在 WebAPI 應用程式的 Web.config 中加入如下設定:

<system.webServer>     <modules>         <remove name="WebDAVModule" />     </modules>     <handlers>         <remove name="WebDAV" />     </handlers> </system.webServer>

 

背景知識

WebDAV 是超文字傳輸通訊協定 (HTTP) (HTTP) 的一組擴充,為 Internet 上電腦之間的編輯和檔案管理提供了標準。利用這個協議使用者可以通過Web進行遠端基本檔案操作,如拷貝、移動、刪除等。
在IIS 7.0中,WebDAV是作為獨立擴充模組,需要單獨進行下載,而IIS 7.5中將整合WebDAV,然而WebDav把Put,Post,Delete給哢嚓了。
所以在IIS 7.5上部署的RESTful服務(WCF Data Service,WCF Rest Service,ASP.NET Web API,ASP.NET MVC)就悲劇了,當發送Put請求就會發生HTTP Error 405.0 – Method Not Allowed錯誤。

參考資料

http://www.cnblogs.com/shanyou/archive/2012/03/23/2414252.html

請求部署在 IIS7.5 上的 REST 服務的 Put/Post/Delete 操作發生 HTTP Error 405.0 - Method Not Allowed 錯誤之解決

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.