WCF client connection problem
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 开发者_Python百科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
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.
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?
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.
精彩评论