为什么“localhost”会这样?在 Web 引用中导致 SocketExceptions?

发布于 2024-08-26 04:58:25 字数 321 浏览 6 评论 0原文

我有两个使用 SSL 部署到同一 IIS 服务器的 .net Web 服务,一个引用另一个。

如果我将该 Web 引用设置为“localhost”,则某些调用会失败并出现以下异常:

System.Web.Services.Protocols.SoapException: 服务器无法处理请求。 ---> System.Net.WebException:无法连接到远程服务器 ---> System.Net.Sockets.SocketException:无法建立连接,因为目标计算机主动拒绝它

如果我将其设置为实际计算机名称,则它可以工作。

为什么?

I have two .net web services deployed to the same IIS server using SSL, one that references the other.

If I set that web reference to 'localhost', some calls fail with this exception:

System.Web.Services.Protocols.SoapException:
Server was unable to process request.
---> System.Net.WebException: Unable to connect to the remote server
---> System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it

If I set it to the actual machine name, it works.

Why?

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

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

发布评论

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

评论(2

梦晓ヶ微光ヅ倾城 2024-09-02 04:58:25

我怀疑您会发现 IIS 配置为侦听“真实”网络接口上的请求,而不是环回适配器上的请求。

您应该能够使用普通浏览器看到这一点 - 尝试转到框中的 https://localhost 并查看会发生什么。

I suspect you'll find that IIS is configured to listen for requests on the "real" network interface but not on the loopback adapter.

You should be able to see this with a plain browser - try going to https://localhost on the box and see what happens.

你是年少的欢喜 2024-09-02 04:58:25

127.0.0.1 可能可以解决该问题。为什么?我不知道——从实验中得到。

The 127.0.0.1 possibly can resolve the problem. Why? I dont know- get from the experiments.

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