如何配置 IIS 7.5 以允许使用 WCF 数据服务进行插入和删除(PUT 和 DELETE)
我有一个 WCF 数据服务,可以在我的开发系统上正常运行。但是当我将它部署到客户端的 Web 服务器时,插入、更新和删除都失败了。更新失败并显示“401 - 未经授权:由于凭据无效,访问被拒绝”。这似乎是一个集成身份验证问题。我在 StackOverflow 上找到了一种解决方法,涉及为“经过身份验证的用户”在我的 .svc 文件上设置完全权限,现在可以更新工作。我还发现了 Zoiner Tejada 的 WCF 数据服务博客,其中解释了处理此问题的正确方法。
但插入和删除仍然不起作用。我收到“405 - 不允许用于访问此页面的 HTTP 动词”。通过 Fiddler 验证,动词是 PUT 和 DELETE。
我将该服务作为应用程序部署在我的网站下。应用程序池是“ASP.NET v4.0”,管道模式是集成的。
以下是我所知道的关于映射动词的知识。在 IIS 管理器中,我右键单击该应用程序,然后单击“处理程序映射”,我发现为路径 *.svc 注册了“svc-Integrated-4.0”。当我单击“编辑”,然后单击“请求限制”,然后单击“动词”时,会选择“所有动词”。 我被困住了——我怎样才能让它发挥作用?
I have a WCF Data Service that works fine on my development system. But when I deployed it to my client's web server, inserts, updates, and deletes all failed. Updates failed with "401 - Unauthorized: Access is denied due to invalid credentials." This seems to be an integrated authentication problem. I found a workaround on StackOverflow involving setting full permissions on my .svc file for "Authenticated Users" and now updates work. I also found a WCF Data Services blog by Zoiner Tejada that explains the correct way to take care of this issue.
But inserts and deletes still don't work. I'm getting "405 - HTTP verb used to access this page is not allowed." As verified with Fiddler, the verbs are PUT and DELETE.
I deployed the service as an application under my website. The Application Pool is "ASP.NET v4.0," and Pipeline Mode is Integrated.
The following is what I know about mapping verbs. In IIS Manager, I right-click on the application and then click Handler Mappings, and I find "svc-Integrated-4.0" registered for the path *.svc. When I click Edit for that, then Request Restrictions, then Verbs, "All Verbs" is selected.
I'm stuck – how can I get this to work?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
解决方法:将
DataServiceContext.UsePostTunneling
属性设置为 true。Workaround: set the
DataServiceContext.UsePostTunneling
property to true.