WCF - 未找到EndPoint异常

时间:2016-05-04 19:28:06

标签: web-services web-config app-config wcf-endpoint endpointnotfoundexception

我一直在打击我的头两天,并尝试了一些事情试图让这个工作无济于事。我试图让这个系统在我的本地机器上运行以进行调试。我希望这里有人可以看到我已经失明的东西,或者可以提供某种建议。

我有两个wcf服务(实际上是4个,但稍后会有更多)。一个是在IIS上运行的SOAP Web服务。 Web服务正在尝试调用其他服务(代理)。在生产环境中,两个服务之间有两个防火墙。他们使用net.tcp协议和证书安全性进行连接。

我们使用自签名证书进行开发和qa目的。

我已安装客户端和服务证书,并已授予应用程序池对证书的读取权限。

我已经验证Net.Tcp端口共享服务,Net.Tcp侦听器适配器,Net.Pipe侦听器适配器都在运行。

启用net.tcp协议并在IIS中定义net.tcp绑定。

防火墙已关闭。

两种服务都连接到身份管理服务(IMS),该服务也是在qa服务器上运行的WCF服务,而不是我的本地计算机。 Web服务能够成功连接到IMS服务。我试图使用相同的绑定来连接代理服务。据我所知,地址,绑定和契约在webservice和代理之间都是匹配的,但我仍然得到EndPointNotFoundException。我错过了什么?

以下是webservice的web.config中的system.serviceModel部分:

  <system.serviceModel>
<client>
  <endpoint address="net.tcp://localhost:8102/Acord/201307" behaviorConfiguration="NetTcpCertificatesBehavior" binding="netTcpBinding" bindingConfiguration="NetTcpCertificatesBinding" contract="AcordContract.IAcordService201307" name="AcordCertificateEndpoint">
    <identity>
      <certificateReference findValue="(value redacted)" isChainIncluded="false" storeLocation="LocalMachine" x509FindType="FindByThumbprint" />
      <dns value="localhost" />
    </identity>
  </endpoint>
</client>
<behaviors>
  <endpointBehaviors>
    <behavior name="NetTcpCertificatesBehavior">
      <clientCredentials>
        <clientCertificate findValue="(value redacted)" storeLocation="LocalMachine" storeName="My" x509FindType="FindByThumbprint" />
        <serviceCertificate>
          <authentication certificateValidationMode="None" />
        </serviceCertificate>
      </clientCredentials>
    </behavior>
  </endpointBehaviors>
</behaviors>
<bindings>
  <netTcpBinding>
    <binding name="NetTcpCertificatesBinding" maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
      <security>
        <transport clientCredentialType="Certificate" protectionLevel="EncryptAndSign" />
      </security>
    </binding>
    <binding name="NetTcpMessageCertificatesBinding" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
             transactionFlow="false" transferMode="Buffered" transactionProtocol="OleTransactions" hostNameComparisonMode="StrongWildcard" listenBacklog="100"
             maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxConnections="100" maxReceivedMessageSize="2147483647">
      <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
      <reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false" />
      <security mode="Message">
        <message clientCredentialType="Certificate" />
      </security>
    </binding>
    <binding name="NetTcpWindowsBinding" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:01:00" sendTimeout="00:10:00"
             transactionFlow="false" transferMode="Buffered" transactionProtocol="OleTransactions" hostNameComparisonMode="StrongWildcard"
             listenBacklog="10" maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxConnections="10" maxReceivedMessageSize="2147483647">
      <readerQuotas maxDepth="32" maxStringContentLength="65535" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384"/>
      <reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false"/>
      <security mode="Transport">
        <transport clientCredentialType="Windows" protectionLevel="EncryptAndSign"/>
        <message clientCredentialType="Windows"/>
      </security>
    </binding>
    <binding name="NetTcpMessageWindowsBinding" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" transactionFlow="false" transferMode="Buffered" transactionProtocol="OleTransactions" hostNameComparisonMode="StrongWildcard" listenBacklog="100" maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxConnections="100" maxReceivedMessageSize="2147483647">
      <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384"  />
      <reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false" />
      <security mode="Message">
        <message clientCredentialType="Windows" />
      </security>
    </binding>
  </netTcpBinding>
</bindings>

以下是代理服务的app.config中的system.serviceModel部分:

<system.serviceModel>
<diagnostics performanceCounters="Default"/>
<bindings>
  <netTcpBinding>
    <binding name="NetTcpWindowsBinding" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:01:00" sendTimeout="00:10:00" 
             transactionFlow="false" transferMode="Buffered" transactionProtocol="OleTransactions" hostNameComparisonMode="StrongWildcard" 
             listenBacklog="10" maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxConnections="10" maxReceivedMessageSize="2147483647">
      <readerQuotas maxDepth="32" maxStringContentLength="65535" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384"/>
      <reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false"/>
      <security mode="Transport">
        <transport clientCredentialType="Windows" protectionLevel="EncryptAndSign"/>
        <message clientCredentialType="Windows"/>
      </security>
    </binding>
    <binding name="NetTcpCertificatesBinding" maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" sendTimeout="00:10:00" portSharingEnabled="true">
      <security>
        <transport clientCredentialType="Certificate" protectionLevel="EncryptAndSign"/>
      </security>
    </binding>
    <binding name="NetTcpMessageWindowsBinding" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" transactionFlow="false" transferMode="Buffered" transactionProtocol="OleTransactions" hostNameComparisonMode="StrongWildcard" listenBacklog="100" maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxConnections="100" maxReceivedMessageSize="2147483647">
      <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384"  />
      <reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false" />
      <security mode="Message">
        <message clientCredentialType="Windows" />
      </security>
    </binding>      
  </netTcpBinding>
</bindings>
<services>
  <service name="AcordAgent.AcordService" behaviorConfiguration="AcordServiceBehavior">

    <endpoint address="http://qaschedapp:8100/Acord" binding="webHttpBinding" behaviorConfiguration="HttpWebGetBehavior" contract="AcordContract.IMeta" name="MetaEndpoint">
      <!--the name of this endpoint above (MetaEndpoint) must stay-->
    </endpoint>
    <!--binding for clients within the firewall calling from C# with WCF -->
    <endpoint address="net.tcp://localhost:8101/Acord/201307" binding="netTcpBinding" bindingConfiguration="NetTcpMessageWindowsBinding" name="NetTcpWindowsEndpoint" contract="AcordContract.IAcordService201307">
      <identity>
        <dns value="localhost"/>
      </identity>
    </endpoint>
    <!--binding for clients outside the firewall calling from C# with WCF using certs -->
    <endpoint address="net.tcp://localhost:8102/Acord/201307" binding="netTcpBinding" bindingConfiguration="NetTcpCertificatesBinding" name="NetTcpCertificatesEndpoint" contract="AcordContract.IAcordService201307">
      <identity>
        <dns value="localhost"/>
      </identity>
    </endpoint>
    <endpoint address="net.tcp://localhost:8102/Acord/mex" binding="mexTcpBinding" contract="IMetadataExchange"/>
  </service>
</services>
<behaviors>
  <endpointBehaviors>
    <behavior name="NetTcpCertificatesBehavior">
      <clientCredentials>
        <clientCertificate findValue="(value redacted)" storeLocation="LocalMachine" storeName="My" x509FindType="FindByThumbprint"/>
        <serviceCertificate>
          <authentication certificateValidationMode="None"/>
        </serviceCertificate>
      </clientCredentials>
    </behavior>
  </endpointBehaviors>
  <serviceBehaviors>
    <behavior name="AcordServiceBehavior">
      <serviceDebug includeExceptionDetailInFaults="true"/>
      <serviceCredentials>
        <serviceCertificate findValue="(value redacted)" storeLocation="LocalMachine" storeName="My" x509FindType="FindByThumbprint"/>
        <clientCertificate>
          <certificate findValue="(value redacted)" storeLocation="LocalMachine" storeName="My" x509FindType="FindByThumbprint"/>
        </clientCertificate>
      </serviceCredentials>
    </behavior>
  </serviceBehaviors>
</behaviors>

附录:我刚刚运行netstat -a而且我没有看到任何在8102端口收听的内容。所以很清楚这就是为什么我得到的回应。我现在的问题是,为什么代理人不在收听8102?我在Visual Studio 2015中运行代理服务并设置了断点。我是否需要安装该服务然后附加到该流程?

1 个答案:

答案 0 :(得分:0)

嗯,问题是这个应用程序的配置文件中有一个appSetting控制是否创建了servicehost,并且设置被设置为false。我不能说为什么配置文件中有这样的设置。但是,将appSetting设置为true只会显示一个全新的问题。那么,接下来的问题。