Note that there are some explanatory texts on larger screens.

plurals
  1. POWebAPI DELETE request return 404 error in Azure
    primarykey
    data
    text
    <p>I have been trying to get the DELETE requests in my ASP.net WebAPI(ASP.net web role) working on Azure and locally on my machine.But end up getting "not found" error.</p> <p>I have following configuration for the web.config of the ASP.net WebAPI web role:</p> <pre><code>&lt;system.webServer&gt; &lt;validation validateIntegratedModeConfiguration="false" /&gt; &lt;modules&gt; &lt;remove name="WebDAVModule" /&gt; &lt;/modules&gt; &lt;handlers&gt; &lt;remove name="WebDAV" /&gt; &lt;remove name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" /&gt; &lt;remove name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" /&gt; &lt;remove name="ExtensionlessUrlHandler-Integrated-4.0" /&gt; &lt;add name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0" /&gt; &lt;add name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" responseBufferLimit="0" /&gt; &lt;add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" /&gt; &lt;/handlers&gt; &lt;/system.webServer&gt; </code></pre> <p>For making it work on IISExpress, I changed the $:\Users\\Documents\IISExpress\config\applicationhost.config configuration and commented out the WebDav portions of it and added the "PUT,DELETE" verbs appropriately.</p> <p>To test my WebAPI I created a simple windows forms (.net 4.5 ) c# application and used the httpclient as below:</p> <pre><code>const string key = "user1"; var client = new HttpClient { BaseAddress = new Uri("http://abcd.cloudapp.net/") }; client.DefaultRequestHeaders.Accept.Add( new MediaTypeWithQualityHeaderValue("application/json")); var requestUrl = string.Format("api/user/{0}", key); var deleteAsync = client.DeleteAsync(requestUrl).Result; </code></pre> <p>The response I get it following:</p> <pre><code>{StatusCode: 404, ReasonPhrase: 'Not Found', Version: 1.1, Content: System.Net.Http.StreamContent, Headers: { Pragma: no-cache Cache-Control: no-cache Date: Fri, 12 Apr 2013 06:40:31 GMT Server: Microsoft-IIS/8.0 X-AspNet-Version: 4.0.30319 X-Powered-By: ASP.NET Content-Length: 128 Content-Type: application/json; charset=utf-8 Expires: -1 }} System.Net.Http.HttpResponseMessage </code></pre> <p>How do I get it to work on Azure? and possibly on my local machine as well.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload