Link to home
Start Free TrialLog in
Avatar of webressurs
webressursFlag for Norway

asked on

Call webservice from HTTP Delete method in ASP.NET Web API (IIS 6.0)

In my ASP.NET Web API I got this error when running HTTP Delete:

Failed to load resource: the server responded with a status of 501 (Not Implemented)

After making a wildcard mapping in IIS the HTTP Delete finally works fine (gallery image is correctly deleted ). This is how I made the mapping in IIS:

http://www.proworks.com/blog/2012/11/14/how-to-fix-aspnet-mvc-web-api-http-put-and-delete-requests-failing/

Each time I make a HTTP Post in my Web API I update/delete the cache at the Remote website by calling a webservice (.asmx). That works perfect. But, when I make a HTTP Delete the same webservice call don't work (Remote cache is not updated).

So, my question is:
Why is it not possible to call a external webservice from a HTTP Delete method?
Avatar of kaufmed
kaufmed
Flag of United States of America image

So you have a Web API action declared in your Web API controller that is decorated with the Delete attribute?

e.g.

public class YourController : ApiController
{
    // Some methods

    [HttpDelete]
    public ActionResult YourDeleteAction()
    {
        // some code
    }

    // Some more methods
}

Open in new window

'HTTP Delete' is usually blocked to prevent people from deleting the files that make up your web site.  'Delete webservice.aspx' would be a request to delete your web service page.  http://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol
ASKER CERTIFIED SOLUTION
Avatar of webressurs
webressurs
Flag of Norway image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of webressurs

ASKER

Problem solved by fixing the cache webservice.