开发者

EndpointNotFoundException in webservice call from website, but not from console application

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>
</bi开发者_如何学编程nding>
</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.


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


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


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??

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜