我正在尝试连接到我们的Intranet中托管的服务。但是这样做的时候我收到了这个错误:
System.ServiceModel.EndpointNotFoundException: There was no endpoint listening at http://10.XXX.X.XXX:XXXX/servicename/services/SomeSearch.SomeSearchHttpSoap12Endpoint/ that could accept the message. This is often caused by an incorrect address or SOAP action.
内部例外说:
System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: 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 http://10.XXX.X.XXX:XXXX
这是我的配置文件:
<?xml version="1.0"?>
<configuration>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="SomeSearchSoap11Binding" 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="None">
<transport clientCredentialType="None" proxyCredentialType="None" realm=""/>
<message clientCredentialType="UserName" algorithmSuite="Default"/>
</security>
</binding>
</basicHttpBinding>
<customBinding>
<binding name="SomeSearchSoap12Binding" receiveTimeout="01:10:00">
<textMessageEncoding maxReadPoolSize="64" maxWritePoolSize="16" messageVersion="Soap12" writeEncoding="utf-8" >
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384"/>
</textMessageEncoding>
<httpTransport manualAddressing="false" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" allowCookies="false" authenticationScheme="Anonymous" bypassProxyOnLocal="false" decompressionEnabled="true" hostNameComparisonMode="StrongWildcard" keepAliveEnabled="true" maxBufferSize="65536" proxyAuthenticationScheme="Anonymous" realm="" transferMode="Buffered" unsafeConnectionNtlmAuthentication="false" useDefaultWebProxy="true"/>
</binding>
</customBinding>
</bindings>
<client>
<endpoint address="http://10.XXX.X.XXX:XXXX/servicename/services/SomeSearch.SomeSearchHttpSoap11Endpoint/" binding="basicHttpBinding" bindingConfiguration="SomeSearchSoap11Binding" contract="SomeService.SomeSearchPortType" name="SomeSearchHttpSoap11Endpoint"/>
<endpoint address="http://10.XXX.X.XXX:XXXX/servicename/services/SomeSearch.SomeSearchHttpSoap12Endpoint/" binding="customBinding" bindingConfiguration="SomeSearchSoap12Binding" contract="SomeService.SomeSearchPortType" name="SomeSearchHttpSoap12Endpoint"/>
</client>
</system.serviceModel>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
这是我遵循的步骤:
我通过提供wsdl路径添加了服务引用。
实例化SomeSearchPortTypeClient
在客户端上调用方法如下:
var someService = new SomeSearchPortTypeClient(“SomeSearchHttpSoap12Endpoint”); var documents = someService.getSomething(“123”);
当我这样做时,我得到了上述异常。
我也试过ping到10.XXX.XXX.XXXX,超时了。这可能是防火墙问题吗?如果是的话,我的下一步应该是什么?我应该采取什么其他角度来实现这一目标?
需要注意的一点是,代理客户端实例化时没有任何异常,只有在进行服务调用时才会抛出此错误。