401 Unauthorized with OData Update and Delete

我是研究僧i 提交于 2020-01-16 19:24:25

问题


For the first time I have stumbled upon a problem where the solution has not already been provided (completely) on SO, but I hope someone out there can help.

My problem is similar to PUT and DELETE in RESTful WCF Service cause 401 Unauthorized error .

That is, I have a WCF Data Service where I get a 401 whenever I try to do updates or deletes (read and post works without any problems). The difference to the abovementioned post is that I am not hosting my service in IIS but on Windows Azure, so I am not able to apply that solution.

I have the same problem (401: invalid credentials when attempting updates or deletes) on both a .NET client and a restlet client using the OData extension. However, on the .NET client I am able to resolve the issue by setting UsePostTunneling = true.

In my service I have set config.SetEntitySetAccessRule("*", EntitySetRights.All).

Does anyone know how I can resolve the issue for my restlet client?


回答1:


First thing I would check is to see if you have PUT and DELETE verbs enabled in your handlers. Are you running this from a web role in full IIS or are you using Hosted Web Core (HWC), or something else? Usually, more than a 401, I see a 405 error because WebDAV is on the machine and PUT and DELETE verbs conflict there. You end up having to disable WebDAV for the app.

I would also check your authentication method in your web.config. I have seen the 'none' type cause issues, so change that to Forms.



来源:https://stackoverflow.com/questions/6705514/401-unauthorized-with-odata-update-and-delete

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!