views:

439

answers:

3

I'm getting this EndpointNotFoundException on a webservice call from a website, while the same exact call works if I do it from a console application. Here's the more detailed exception message:

Could not connect to https://******. 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 ***.***.***.***:443. 

I've confirmed that the bindings (in web.config and app.config) are the same, so I can't see why it works in one case and not in the other.

<basicHttpBinding>
<binding name="ServicePortBinding" closeTimeout="00:01:00" openTimeout="00:01:00"
 receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false"
 bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
 maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
 messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
 useDefaultWebProxy="true">
 <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
  maxBytesPerRead="4096" maxNameTableCharCount="16384" />
 <security mode="Transport">
  <transport clientCredentialType="None" proxyCredentialType="None"
   realm="" />
  <message clientCredentialType="UserName" algorithmSuite="Default" />
 </security>
</binding>
</basicHttpBinding>

Let me know if you need any more details.

EDIT
OK, here's something I left out that might be causing the issue. This is all happening behind the company firewall. Could it be that said firewall is preventing it from running from the website because it's an HTTP connection spawned from an existing "web process"? Whereas in the console app it's just a single connection.

A: 

Have you tried using wireshark (or Fiddler if it's HTTP) to see if the outbound calls appear to be equivalent and correct?

STW
You know what the weirdest thing is? I installed Fiddler and when the program is running, it works! As soon as I turn Fiddler off, I get the timeout again...
Farinha
A: 

Sounds and smells like a permission issue.

Your web app typically runs as ASPNET or NETWORK SERVICE, while your console app will run as yourself (your account).

Any chance there's a problem there??

Do you do any kind of authentication on the WCF server end that might work for normal user account, but not for ASPNET / NETWORK SERVICE??

marc_s
The only thing I could think of was the security mode, but just tried changing it to None and I still get the same error.
Farinha
A: 

You need to add a proxy bypass in your web.config

  <system.net>
    <defaultProxy>
      <proxy
      usesystemdefault = "true"
      proxyaddress="http://theproxyaddress:PortNumber"
      bypassonlocal="false"
/>
    </defaultProxy>
  </system.net>

This will allow you to open a connection to the service through your firewalls

Solyad
Thks! That solved it!
Farinha