LoginSignup
5
3

More than 5 years have passed since last update.

IISでHTTP Dlete, Putに失敗する時の回避策

Posted at

405エラー

WebAPIでHTTP Deleteを呼びだしたときに
405 errorで弾かれました。

image

Fiddlerで見たところ応答は以下のような感じです。

HTTP/1.1 405 Method Not Allowed
Allow: GET, HEAD, OPTIONS, TRACE
Content-Type: text/html
Server: Microsoft-IIS/8.5
Persistent-Auth: true
X-Powered-By: ASP.NET
Content-Length: 1306
<head>
<meta http-equiv="Content-Type" content="text/html; charset=shift_jis"/>
<title>405 - このページにアクセスするために使用された HTTP 動詞は許可されていません。</title>

解決

Stack Overflowにも同様の質問が出ていました。

Asp.NET Web API - 405 - HTTP verb used to access this page is not allowed - how to set handler mappings - Stack Overflow

結果的には以下をWeb.configに追加すればOKでした

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

5
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
3