How to use http delete, put, head, connections, connect with an Azure Web App

Bild des Benutzers Marcel Meurer

I often use Azure Web Apps to deploy tools and programs running serverlessly. A few weeks ago, I deployed an MVC web site with a controller to handle file uploads to an Azure Storage Account. For the client site I used jquery-FileUpload, which also allows to trigger a controller to delete a file. If a user tries to delete a file, jquery-FileUpload triggers the controller with the http-request method “DELETE”.

In my local environment this worked as expected but nothing happened in my Azure Web App deployment.

If found out that an Azure Web App supports only http-get and post by default. My first attempt was to add the methods DELETE via web.config:

<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb=" DELETE" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />

But this didn’t work. The full web site was no longer accessible:

The page cannot be displayed because an internal server error has occurred.

The right way to add a method/verb is to remove all first and then re-add them:

<remove name="ExtensionlessUrlHandler-Integrated-4.0" />
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="GET,POST,PUT,DELETE" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />

Neuen Kommentar schreiben
Durch Absenden dieses Formulars akzeptieren Sie die Mollom Privatsphärenrichtlinie.