iT邦幫忙

3

[C#] Web Api 發生 HTTP 405 - Method Not Allowed 錯誤

  • 分享至 

  • xImage
  •  

將 Web Api 部屬到 IIS 後,發現有使用到 PUTDELETE 這兩個 HTTP Method 的 API,會出現 HTTP 405 - Method Not Allowed 的錯誤,在本機測試時都正常。

Google 後找到原因,PUTDELETE 與 IIS上的 WebDAV 這個套件衝突。

解決辦法,在 Web.config 加入以下設定:

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

圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言