WCF-找不到端点异常



两天来,我一直在为此绞尽脑汁,并尝试了许多方法试图让它发挥作用,但都无济于事。我正试图让这个系统在我的本地机器上运行,以进行调试。我希望这里有人能看到我视而不见的东西,或者能提供一些建议。

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

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

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

我已经验证了Net。Tcp端口共享服务,网络。Tcp侦听器适配器,网络。管道侦听器适配器都在运行。

net.tcp协议已启用,并且在IIS中定义了net.tcp绑定。

防火墙关闭。

这两个服务都连接到身份管理服务(IMS),该服务也是运行在qa服务器上的WCF服务,而不是我的本地计算机。Web服务能够成功连接到IMS服务。我正在尝试使用相同的绑定连接到代理服务。据我所知,web服务和代理之间的地址、绑定和契约都是匹配的,但我仍然得到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中运行了代理服务,并设置了断点。我需要安装服务然后连接到进程吗?

问题是这个应用程序的配置文件中有一个appSetting,它控制是否创建servicehost,并且该设置被设置为false。我不知道为什么配置文件中有这样的设置。然而,将appSetting设置为true只是揭示了一个全新的问题。那么,接下来的问题。

相关内容

  • 没有找到相关文章

最新更新