WCF Web服务正在引发EndPointNotFoundException
本文关键字:EndPointNotFoundException Web 服务 WCF | 更新日期: 2023-09-27 17:58:19
我正在尝试配置WCF服务以支持与客户端服务的双工通信,由于我切换到WSDualHttpBinding,我现在在IIS 中的服务上获得了此功能
没有在侦听的终结点http://exampple.com/Temporary_Listen_Addresses/06be1668-e09f-441c-9fc9-999e4922d4a8/1002945c-979b-484e-a2c5-fa3470b6706d可以接受这个消息的。这通常是由不正确的地址或SOAP操作引起的。有关更多详细信息,请参见InnerException(如果存在)。内部异常为null,并且基本上服务器上的服务托管在IIS中,然后我在客户端计算机上有一个自托管服务连接到服务器,还有一个客户端应用程序连接到自托管服务。wsDualHttpbinding从服务器到自托管服务,自托管服务公开一个命名管道供客户端应用程序通信。
这是来自服务的Web.config:
<?xml version="1.0"?>
<configuration>
<system.serviceModel>
<protocolMapping>
<remove scheme="http" />
<add scheme="http" binding="wsDualHttpBinding" />
</protocolMapping>
<bindings>
<wsDualHttpBinding>
<binding name="WsDualHttp_EcuWebBinding" />
</wsDualHttpBinding>
</bindings>
<services>
<service behaviorConfiguration="EcuWebServiceBehavior" name="EcuWeb.Service.EcuWebService">
<endpoint address="/EcuWebService.svc" binding="wsDualHttpBinding" bindingConfiguration="WsDualHttp_EcuWebBinding" name="WsDualHttp_EcuWeb" contract="EcuWeb.Service.IEcuWebService" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="EcuWebServiceBehavior">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" minFreeMemoryPercentageToActivateService="1" multipleSiteBindingsEnabled="true">
<serviceActivations>
<add relativeAddress="EcuWebService.svc" service="EcuWeb.Service.EcuWebService" />
</serviceActivations>
</serviceHostingEnvironment>
</system.serviceModel>
</configuration>
这是我的主机应用程序的App.config:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<client>
<endpoint address="http://localhost:51334/EcuWebService.svc/EcuWebService.svc" binding="wsDualHttpBinding" bindingConfiguration="WsDualHttp_EcuWeb" contract="EcuWebService.IEcuWebService" name="WsDualHttp_EcuWeb">
<identity>
<userPrincipalName value="myusername@domain.com" />
</identity>
</endpoint>
</client>
<behaviors>
<serviceBehaviors>
<behavior name="NetNamedPipeBehavior_EcuService">
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<netNamedPipeBinding>
<binding name="NetNamedPipedBinding_EcuService" />
</netNamedPipeBinding>
<wsDualHttpBinding>
<binding name="WsDualHttp_EcuWeb" />
</wsDualHttpBinding>
</bindings>
<services>
<service behaviorConfiguration="NetNamedPipeBehavior_EcuService"
name="Ecu.Services.EcuService">
<endpoint address="net.pipe://localhost/EcuNamedPipe" binding="netNamedPipeBinding" bindingConfiguration="NetNamedPipedBinding_EcuService" name="NetNamedPipeBinding_IEcuService" contract="Ecu.Services.IEcuService" />
</service>
</services>
</system.serviceModel>
</configuration>
最后是来自客户端测试应用程序的App.config:
<?xml version="1.0"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
</startup>
<system.serviceModel>
<bindings>
<netNamedPipeBinding>
<binding name="NetNamedPipeBinding_IEcuService" />
</netNamedPipeBinding>
</bindings>
<client>
<endpoint address="net.pipe://localhost/EcuNamedPipe" binding="netNamedPipeBinding" bindingConfiguration="NetNamedPipeBinding_IEcuService" contract="EcuServiceClient.IEcuService" name="NetNamedPipeBinding_IEcuService">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
</client>
</system.serviceModel>
</configuration>
由于SO上的另一篇文章向我介绍了这篇关于WCF双工服务的文章,我已经修复了这个问题。双面文章
一旦我切换到net.tcp并设置好使用它的一切,双工通信就没问题了。