简体   繁体   English

来自网站的webservice调用中的EndpointNotFoundException,但不是来自控制台应用程序

[英]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. 我在来自网站的webservice调用上得到此EndpointNotFoundException ,而如果我从控制台应用程序执行此操作,则同样的调用可以正常工作。 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. 我已经确认绑定(在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>

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"? 可能是防火墙阻止它从网站运行,因为它是从现有“网络进程”产生的HTTP连接? Whereas in the console app it's just a single connection. 而在控制台应用程序中,它只是一个连接。

You need to add a proxy bypass in your web.config 您需要在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 这将允许您通过防火墙打开与服务的连接

您是否尝试过使用wireshark(或Fiddler,如果它是HTTP)来查看出站呼叫是否相同且正确?

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). 您的Web应用程序通常以ASPNET或NETWORK SERVICE运行,而您的控制台应用程序将以您自己(您的帐户)运行。

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?? 您是否在WCF服务器端进行任何可能适用于普通用户帐户的身份验证,但不适用于ASPNET / NETWORK SERVICE?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM