为什么 WCF 服务在 IIS 6.0 上给出 401 错误

发布于 2025-01-02 10:05:52 字数 431 浏览 3 评论 0原文

我在运行 IIS 6.0 的 Windows Server 2003、XP 机器上遇到了这个奇怪的问题。我有一个使用应用程序池标识部署的 WCF 服务。我可以在该框中浏览这样的 svc 文件,

http://localhost/servicename.svc

但是当我执行http://machinename/servicename.svc,它要求提供凭据。 该网站配置为匿名访问和集成 Windows 身份验证。

我真的不确定这里出了什么问题,我有另一台机器是这个盒子的故障转移位置,在 IIS 中使用完全相同的设置,同样的事情可以正常工作。

I have this wierd problem on our Windows Server 2003, XP box running IIS 6.0. I have a WCF service deployed using an application pool identity. I am able to browse the svc file like this on that box,

http://localhost/servicename.svc

But when I do http://machinename/servicename.svc, it asks for credentials.
The website is configured for Anonymous access and Integrated Windows authentication.

I am really not sure what is wrong here, I have another machine that is a failover location for this box, where the same thing works fine with exactly same settings in IIS.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

深居我梦 2025-01-09 10:05:52

确保应用程序池标识具有 Read &对 IIS 托管的文件执行访问(即检查 D:\path\to\site 中的文件)。无论是网络服务、域帐户还是其他......它都需要 R&X 权限。

我猜测发生的情况是您是服务器上的本地管理员,因此当您在本地执行此操作时,您可以使用自己的本地凭据来提取站点。但是,当您远程执行此操作时,即使启用了匿名访问,IIS 也必须有权访问这些文件(否则,它如何加载文件来为您提供页面服务?)。

如果您仍然感到困惑,请尝试在发出请求时在服务器上使用 filemon 或 procmon 之类的本地程序,并查看当您收到 401 错误时出现访问被拒绝的情况。

Make sure that the Application Pool identity has Read & Execute access on the files hosted by IIS (in other words, check the files at D:\path\to\site). Whether it's Network Service, a domain account, whatever.. it's going to need R&X permission.

What I'm guessing that's happening is that you're a local Admin on the server, so when you do it locally you're able to use your own local credentials to pull the site. But when you do it remotely, IIS must have access to these files - even if Anonymous access is enabled (otherwise, how can it load the files to serve the page to you?).

If you're still stumped, try using a program like filemon or procmon local on the server while making the request, and see what's getting Access Denied when you get a 401.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文