Hi, can someone point me in the right direction for configuring IIS to accept deletes the web API? I have selects working and Fiddler returns a 200 when it post a delete but IIS doesn't call the actual delete method.
Here's the JQUERY code that calls the delete method:
If WebDav is installed then it might be intercepting these verbs and responding rather than allowing these to continue to your code. Uninstall WebDav (you can't just disable it, you need to uninstall it) and see if the problem persists.
So that means that it's getting to WebApi and to the right controller -- good news. The 405 means that
the controller doesn't have an action method that matches the verb being requested.
Blackhawksq
Member
85 Points
21 Posts
IIS configuration for delete
Apr 25, 2012 06:39 PM|LINK
Hi, can someone point me in the right direction for configuring IIS to accept deletes the web API? I have selects working and Fiddler returns a 200 when it post a delete but IIS doesn't call the actual delete method.
$.ajax({ url: "http://dev.dal.absint.com/api/Notification/" + notificationId, type: 'DELETE', cache: false });Here's the current Delete call. // DELETE /api/values/5 public HttpResponseMessage Delete(int id) { var notifyobj = saasContext.UserNotifications.First(c => c.UserNotificationId == id); saasContext.DeleteObject(notifyobj); saasContext.SaveChanges(); return new HttpResponseMessage(HttpStatusCode.NoContent); }and the fiddler response:
OPTIONS /api/Notification/3295 HTTP/1.1
Host: dev.dal.absint.com
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:11.0) Gecko/20100101 Firefox/11.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip, deflate
Connection: keep-alive
Origin: http://dev.saas.absint.com
Access-Control-Request-Method: DELETE
Access-Control-Request-Headers: x-requested-with
HTTP/1.1 200 OK
Allow: OPTIONS, TRACE, GET, HEAD, POST
Server: Microsoft-IIS/7.5
Public: OPTIONS, TRACE, GET, HEAD, POST
X-Powered-By: ASP.NET
Date: Wed, 25 Apr 2012 18:03:09 GMT
Content-Length: 0
BrockAllen
All-Star
27478 Points
4893 Posts
MVP
Re: IIS configuration for delete
Apr 25, 2012 06:43 PM|LINK
If WebDav is installed then it might be intercepting these verbs and responding rather than allowing these to continue to your code. Uninstall WebDav (you can't just disable it, you need to uninstall it) and see if the problem persists.
DevelopMentor | http://www.develop.com
thinktecture | http://www.thinktecture.com/
ChrisThomas
Member
65 Points
31 Posts
Re: IIS configuration for delete
Apr 26, 2012 02:50 PM|LINK
I found this link a little while ago that explains how to get IIS and IIS Express to accept PUT and DELETE
http://geekswithblogs.net/michelotti/archive/2011/05/28/resolve-404-in-iis-express-for-put-and-delete-verbs.aspx
I was originally getting a 404 when I tried to use delete, but this should still help you out.
Blackhawksq
Member
85 Points
21 Posts
Re: IIS configuration for delete
Apr 26, 2012 06:41 PM|LINK
WebDAV is not installed (which is actually frustating because everyone seems to have to answers concerning Webdav.)
Thanks i tried that before posting... I'm going to delete all the webserver setting and try again...
BrockAllen
All-Star
27478 Points
4893 Posts
MVP
Re: IIS configuration for delete
Apr 26, 2012 06:45 PM|LINK
Bummer -- sorry that wasn't it. Once you sort this out, please post with what happened. I'd be interested in hearing what it was.
DevelopMentor | http://www.develop.com
thinktecture | http://www.thinktecture.com/
Blackhawksq
Member
85 Points
21 Posts
Re: IIS configuration for delete
Apr 27, 2012 07:14 PM|LINK
So now I have it returning a 405. It's actually breaking on the proper constructor... Code problem possibly?
BrockAllen
All-Star
27478 Points
4893 Posts
MVP
Re: IIS configuration for delete
Apr 27, 2012 07:25 PM|LINK
So that means that it's getting to WebApi and to the right controller -- good news. The 405 means that the controller doesn't have an action method that matches the verb being requested.
DevelopMentor | http://www.develop.com
thinktecture | http://www.thinktecture.com/
Blackhawksq
Member
85 Points
21 Posts
Re: IIS configuration for delete
May 01, 2012 03:41 PM|LINK
Found it... It's a CORS problem going from Dev.Saas to Dev.DAL.
rxm
Member
4 Points
5 Posts
Re: IIS configuration for delete
Aug 21, 2012 03:40 PM|LINK
Hi Blackhawksq,
What did you do to get it to stop sending you the canned response for the options and go to the actual code?
Thanks,
Rxm