WCF Web服务正在抛出EndPointNotFoundException

时间:2013-02-08 21:40:03

标签: c# .net wcf exception-handling wcf-endpoint

我正在尝试配置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>

1 个答案:

答案 0 :(得分:0)

我已经解决了这个问题,感谢另一篇关于SO的文章,它指向了我关于WCF Duplex服务的这篇文章。 Duplex Article

一旦我切换到net.tcp并完成所有设置以使用它,双工通信就没有问题。