如何判断哪个帐户正在尝试访问 ASP.NET Web 服务?

发布于 2024-07-27 13:48:25 字数 231 浏览 2 评论 0原文

我在调用内部 Web 服务上的方法时收到 401(访问被拒绝)错误。 我从我们公司 Intranet 上的 ASP.NET 页面调用它。 我已经检查了所有配置,它应该使用集成安全性和有权访问该服务的帐户,但我正在尝试弄清楚如何确认它在哪个帐户下连接。 不幸的是,我无法在生产网络上调试代码。 在我们的开发环境中一切正常。 我知道设置必须有所不同,但我不知道从哪里开始。 有什么建议吗?

I'm getting a 401 (access denied) calling a method on an internal web service. I'm calling it from an ASP.NET page on our company intranet. I've checked all the configuration and it should be using integrated security with an account that has access to that service, but I'm trying to figure out how to confirm which account it's connecting under. Unfortunately I can't debug the code on the production network. In our dev environment everything is working fine. I know there has to be a difference in the settings, but I'm at a loss with where to start. Any recommendations?

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

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

发布评论

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

评论(4

衣神在巴黎 2024-08-03 13:48:25

您查看过 IIS 日志吗?

Have you looked in the IIS logs?

诗笺 2024-08-03 13:48:25

我还建议在服务器上的安全事件日志中查找身份验证失败的情况。 您应该在此处找到失败的授权尝试的足迹。 但请注意 - 每秒获取 10 多个安全事件并不罕见,因此理想情况下,您需要能够在请求失败时访问事件日志。

I would also recommend looking in the Security event log on the server for authentication failures. You should find a footprint of the failed authorisation attempt here. Be warned though - it is not unusual to get 10s of security events a second, so ideally you need to be able to access the event log as the requests are failing.

吐个泡泡 2024-08-03 13:48:25

如果您在实例化 Web 服务时没有指定在 ASP.NET 页面中使用哪些凭据,那么我相信它默认为 NT_Authority\Anonymous

如果您使用 System.Net.CredentialCache,那么您的 Web 服务需要位于受信任的域中,通过 HTTPS 访问并使用 NTLM、Kerberos 或 Digest Auth,否则它不会传递缓存中的凭据。

http://msdn.microsoft.com/en-我们/library/system.net.credentialcache.defaultcredentials.aspx
http://msdn.microsoft.com/en-我们/library/system.net.credentialcache.defaultnetworkcredentials.aspx
http://msdn.microsoft.com/en-我们/library/system.net.credentialcache.defaultcredentials.aspx

If you do not specify which credentials to use in your ASP.NET page when you instantiate the web service then I believe it defaults to NT_Authority\Anonymous.

If you're using System.Net.CredentialCache then your web service needs to be in a trusted domain, accessed over HTTPS and using either NTLM, Kerberos or Digest Auth otherwise it does not pass the credentials from the cache.

http://msdn.microsoft.com/en-us/library/system.net.credentialcache.defaultcredentials.aspx
http://msdn.microsoft.com/en-us/library/system.net.credentialcache.defaultnetworkcredentials.aspx
http://msdn.microsoft.com/en-us/library/system.net.credentialcache.defaultcredentials.aspx

乱了心跳 2024-08-03 13:48:25

也许生产服务器在其应用程序池中使用的用户与您的开发环境不同? 我曾经花了一天的时间来解决这个问题。 另一种选择是 web.config 中(缺乏)模拟

Perhaps the production server uses a different user for its application pool than your dev environment? I once spent a day figuring that one out. Another option would be the (lack of) impersonation in the web.config

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