WCF客户端连接问题

发布于 2024-09-14 06:19:48 字数 615 浏览 7 评论 0原文

我正在使用 WCF 客户端在 .NET 应用程序中使用 Web 服务。

服务的端点地址通过端口 4338 进行,并且通过 HTTPS 进行,并使用 WS-Security 标准进行保护。

所以地址类似于:

https://[servername]:4338/[servicename]/

我无法仅通过运行应用程序与服务进行通信。 它给了我以下错误:

无法连接到[服务器名称]:4338 TCP 错误代码 10060:连接 尝试失败,因为已连接 当事人在事后没有做出适当的回应 一段时间,或既定的 连接失败,因为已连接 主机未能响应 [服务器名称]:4338

但是当我运行 Fiddler 来调查 http 通信时,应用程序开始工作,我将能够与服务进行通信。

另外,我想补充一点,我在托管第一个服务的同一 Web 服务器上有一个不同的服务,而第二个服务的地址托管在端口 8080 上,并且我能够与 WCF 客户端进行通信(无需运行 Fiddler) )。

于是,我google了一下,发现这可能与代理设置有关。您知道问题是什么吗?我该如何解决它?

谢谢

I am consuming a web service in .NET application with WCF client.

The Endpoint's address of the service is over port 4338, and it is over HTTPS, secured with WS-Security standard.

So the address is something like :

https://[servername]:4338/[servicename]/

I was not able to communicate to the service with just running the application.
it gave me the following error :

Could not connect to [servername]:4338
TCP error code 10060: A connection
attempt failed because the connected
party did not properly respond after a
period of time, or established
connection failed because connected
host has failed to respond
[servername]:4338

But when I run Fiddler to investigate the http communication, the application start to work, and I will be able to communicate to the service.

As well, I want to add that I have a different service on the same web server that hosts the first service, and that second service's address is hosted on port 8080, and I am able to communicate with it with WCF client (without running Fiddler).

So, I googled and I found that it might be related to the proxy settings. Do you know what the problem is, and how can I solve it?

Thanks

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

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

发布评论

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

评论(3

紧拥背影 2024-09-21 06:19:48

Fiddler 充当 Internet 代理服务器。一般来说,任何以下形式的症状:“当我使用 Fiddler 时它可以工作”意味着“当有(不同的)代理服务器时它可以工作”。

检查您的代理服务器设置。特别是,正如 empi 建议的那样,在浏览器中尝试一下。如果它在那里工作,可能是因为浏览器配置了代理设置,而您没有为 WCF 配置它们。

Fiddler acts as an Internet proxy server. In general, any symptom of the form: "it works when I use Fiddler" means "it works when there's a (different) proxy server".

Check your proxy server settings. In particular, as empi suggested, try it in a browser. If it works there, it could be due to the fact that the browser has the proxy settings configured, and that you do not have them configured for WCF.

陌伤ぢ 2024-09-21 06:19:48

如果您在 Internet Explorer 中设置了代理,则可能会导致该问题。当您打开 https://[servername]:4338/[servicename]/ 时会发生什么在 Internet Explorer 中?

If you have proxy set in Internet Explorer, it may cause the problem. What happens when you open https://[servername]:4338/[servicename]/ in Internet Explorer?

一紙繁鸢 2024-09-21 06:19:48

感谢empi的回复。
我找到了答案。
实际上在我们公司,我们通过“自动配置脚本”进行代理设置
并且取决于我们内部定位的网站,脚本将为我们指出正确的代理。
因此,从脚本中我得到了正确的代理地址。
在我的 .NET 应用程序中我添加了这段代码
WebRequest.DefaultWebProxy = new WebProxy("http://xx.xx.xx.xx:8080”);
这解决了问题
因此 WCF 客户端未检测到自动脚本的设置。
这就是我运行 Fiddler 时它起作用的原因,因为 Fiddler 监听 http 通信,并通过设置再次发送它。

Thanks empi for the reply.
I found the answer.
Actually in our company we have a proxy settings through "Automatic configuration script"
and depends on the web sites we are targeting internally, the script will point us to the proper proxy.
So, from the script I got the proper proxy address.
and in my .NET application I added this code
WebRequest.DefaultWebProxy = new WebProxy("http://xx.xx.xx.xx:8080");
and that fixed the problem
So WCF client was not detecting the setting of the automatic script.
and this is the reason it worked when I run Fiddler, because Fiddler listen to the http communication, and send it again through the settings.

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