【问题标题】:WCF Web service is throwing EndPointNotFoundExceptionWCF Web 服务正在抛出 EndPointNotFoundException
【发布时间】:2013-02-08 21:40:02
【问题描述】:

我正在尝试配置 WCF 服务以支持与客户端服务的双工通信,并且由于我切换到 WSDualHttpBinding 我现在在 IIS 中的服务上得到了这个

http://exampple.com/Temporary_Listen_Addresses/06be1668-e09f-441c-9fc9-999e4922d4a8/1002945c-979b-484e-a2c5-fa3470b6706d 上没有可以接受消息的端点监听。这通常是由不正确的地址或 SOAP 操作引起的。有关更多详细信息,请参阅 InnerException(如果存在)。内部异常为空,基本上服务器上的服务托管在 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>

【问题讨论】:

  • 我明白你的观点是要节省在外部粘贴箱上发布的空间,但几个月会过去,外部资源发布的代码可能会消失,这将使你的问题(和可能的答案)变得毫无意义。
  • 我试着先把它放在代码标签中,它只显示第一行而不是整个配置。这是我求助于 pastebin 的唯一原因。感谢您修复它。
  • 用4个空格打算格式化代码,很简单:)
  • 来自异常:“请参阅 InnerException,如果存在,了解更多详细信息。”是否有偶然的内在例外?
  • 那么您是在 IIS 中托管还是在应用程序中自行托管?

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


【解决方案1】:

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

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

【讨论】:

    猜你喜欢
    • 2015-06-11
    • 1970-01-01
    • 1970-01-01
    • 2012-02-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-07-11
    • 1970-01-01
    相关资源
    最近更新 更多