【问题标题】:EndpointNotFoundException in webservice call from website, but not from console application来自网站的 Web 服务调用中的 EndpointNotFoundException,但不是来自控制台应用程序
【发布时间】:2011-01-17 23:30:09
【问题描述】:

我在来自网站的 web 服务调用中得到了这个 EndpointNotFoundException,而如果我从控制台应用程序中调用,同样的调用也有效。 以下是更详细的异常消息:

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. 

我已经确认绑定(web.configapp.config)是相同的,所以我不明白为什么它在一种情况下有效而在另一种情况下无效。

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

如果您需要更多详细信息,请告诉我。

编辑
好的,这是我遗漏的可能导致问题的内容。这一切都发生在公司防火墙后面。 难道说防火墙阻止它从网站运行,因为它是从现有的“网络进程”产生的 HTTP 连接?而在控制台应用程序中,它只是一个连接。

【问题讨论】:

  • 网站在哪里?与控制台应用在同一台机器上?
  • 是的,它们都在同一台机器上运行。不过,网络服务不在同一台机器上。

标签: .net wcf web web-services


【解决方案1】:

您需要在 web.config 中添加代理绕过

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

这将允许您通过防火墙打开与服务的连接

【讨论】:

    【解决方案2】:

    您是否尝试过使用 wireshark(或 Fiddler,如果它是 HTTP)来查看出站调用是否等效且正确?

    【讨论】:

    • 你知道最奇怪的是什么吗?我安装了 Fiddler,当程序运行时,它可以工作了!一旦我关闭 Fiddler,我就会再次超时......
    【解决方案3】:

    听起来和闻起来像是权限问题。

    您的 Web 应用程序通常作为 ASPNET 或 NETWORK SERVICE 运行,而您的控制台应用程序将作为您自己(您的帐户)运行。

    那里有问题吗?

    您是否在 WCF 服务器端进行任何可能适用于普通用户帐户但不适用于 ASPNET / NETWORK SERVICE 的身份验证??

    【讨论】:

    • 我唯一能想到的是安全模式,但只是尝试将其更改为无,我仍然得到同样的错误。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-05-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-05-06
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多