来自网站的Webservice调用中的EndpointNotFoundException,但不是来自控制台应用程序 [英] EndpointNotFoundException in webservice call from website, but not from console application

查看:44
本文介绍了来自网站的Webservice调用中的EndpointNotFoundException,但不是来自控制台应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在从网站上通过网络服务调用获取此 EndpointNotFoundException ,而如果从控制台应用程序进行此调用,则可以使用相同的精确调用.这是更详细的异常消息:

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. 

我已经确认绑定(在 web.config app.config 中)是相同的,所以我看不到为什么它在一种情况下有效而不是另一个.

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.

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

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.

推荐答案

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

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

这篇关于来自网站的Webservice调用中的EndpointNotFoundException,但不是来自控制台应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆