実装しようとしたjqueryファイルアップローダーから.ashxハンドラーにDELETEリクエストを送信しようとすると、HTTPエラー405.0-MethodNotAllowedエラーが発生します。
この質問を参照して(http://stackoverflow.com/questions/6695587/enabling-put-on-iis-7-5-for-an-ashx-handler-using-windows-authentication)以下のセクションをに追加しました私のweb.configファイルですが、エラーが消えないようです。DELETEを機能させるために私が見つけていない他のトリックはありますか?
.Net 4.0とIIS7.5を使用しており、WindowsAzureストレージエミュレーターも実行しています。
<system.webServer>
<modules>
<remove name="WebDAVModule" />
</modules>
<handlers accessPolicy="Read, Write, Execute, Script">
<remove name="WebDAV" />
<remove name="SimpleHandlerFactory-Integrated-4.0" />
<remove name="SimpleHandlerFactory-Integrated" />
<add name="SimpleHandlerFactory-Integrated" path="*.ashx" verb="GET,HEAD,POST,DEBUG,PUT,DELETE" type="System.Web.UI.SimpleHandlerFactory" resourceType="Unspecified" requireAccess="Write" preCondition="integratedMode" />
<add name="SimpleHandlerFactory-Integrated-4.0" path="*.ashx" verb="GET,HEAD,POST,DEBUG,PUT,DELETE" type="System.Web.UI.SimpleHandlerFactory" resourceType="Unspecified" requireAccess="Write" preCondition="integratedMode,runtimeVersionv4.0" />
</handlers>
<security>
<authorization>
<remove users="*" roles="" verbs="" />
<add accessType="Allow" users="*" verbs="GET,HEAD,POST,PUT,DELETE,DEBUG" />
</authorization>
</security>
</system.webServer>
そして、ハンドラーを呼び出すフロントエンドコードは次のとおりです。
<td class="delete">
<button class="ui-button ui-widget ui-state-default ui-corner-all ui-button-icon-only" data-url="/webservices/FileTransferHandler.ashx?f=df69bfd1-2a15-43e3-9310-3ca163e2aeb2" data-type="DELETE" role="button" aria-disabled="false" title="Delete">
<span class="ui-button-icon-primary ui-icon ui-icon-trash"></span>
<span class="ui-button-text">Delete</span>
</button>
</td>
失敗したリクエストのトレースを有効にしましたが、.ashxのリクエスト拡張子に基づいてstaticFileModuleを使用しようとしていますが、SimpleHandlerFactoryを使用しようとしていると思います。
これが私がヒットしているリンクです:http://local.testsite.com: 80 / webservices / FileTransferHandler.ashx?f = df69bf1-2a15-43e3-9310-3ca163e2aeb2
そのリンクがstaticFileModuleを使用しているのはなぜですか?.jpgや.pdfなどの画像やドキュメントの場合はそうではありませんか?