Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# WCF Web服务正在引发EndPointNotFoundException_C#_.net_Wcf_Exception Handling_Wcf Endpoint - Fatal编程技术网

C# WCF Web服务正在引发EndPointNotFoundException

C# WCF Web服务正在引发EndPointNotFoundException,c#,.net,wcf,exception-handling,wcf-endpoint,C#,.net,Wcf,Exception Handling,Wcf Endpoint,我正在尝试配置一个WCF服务来支持与客户端服务的双工通信,自从我切换到WSDualHttpBinding后,我现在在IIS中的服务上得到了这个 没有可以接受消息的端点正在侦听。这通常是由不正确的地址或SOAP操作引起的。有关更多详细信息,请参阅InnerException(如果存在)。内部异常为null,服务器上的服务基本上托管在IIS中。然后,我在客户端计算机上有一个连接到服务器的自托管服务,以及一个连接到自托管服务的客户端应用程序。wsDualHttpbinding是从服务器到自托管服务的绑

我正在尝试配置一个WCF服务来支持与客户端服务的双工通信,自从我切换到WSDualHttpBinding后,我现在在IIS中的服务上得到了这个

没有可以接受消息的端点正在侦听。这通常是由不正确的地址或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>
<?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>
最后是客户端测试应用程序中的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>
<?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>

多亏了上的另一篇文章,我已经修复了这个问题,这篇文章是关于WCF双工服务的


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

我明白你在外部粘贴箱上张贴文章的目的是节省空间,但几个月后,外部资源张贴的代码可能会消失,这会使你的问题和可能的答案变得毫无意义。我尝试先将其放在代码标签中,然后它只显示第一行,而不是整个配置。这是我求助于pastebin的唯一原因。感谢您的修复。使用4个空格来格式化代码,非常简单:来自异常:有关更多详细信息,请参阅InnerException(如果存在)。是否碰巧存在内部异常?那么您是在IIS中宿主还是在应用程序中自宿主?