0

Я бил головой об этом в течение двух дней и пробовал несколько вещей, чтобы попытаться заставить это работать безрезультатно. Я пытаюсь заставить эту систему работать на моей локальной машине для целей отладки. Я надеюсь, что кто-то может увидеть что-то, что я стал слепым, или может предложить какой-то совет.WCF - EndPoint Not Found Exception

У меня есть две службы wcf (на самом деле 4, но более подробно об этом позже). Один из них - веб-сервис SOAP, работающий на IIS. Вебсервис пытается сделать вызов другой службе (агенту). В производственной среде между двумя службами есть два брандмауэра. Они используют протокол net.tcp с безопасностью сертификата для подключения.

Мы используем самоподписанные сертификаты для разработки и целей qa.

У меня установлены сертификаты клиентов и сервисов и предоставлен доступ к сертификатам для пула приложений.

Я проверил, что Net.Tcp Port Sharing Service, Net.Tcp Listener Adapter, Net.Pipe Listener Adapter все работает.

net.tcp protocal включен, а привязка net.tcp определена в IIS.

Брандмауэр выключен.

Обе службы подключаются к службе управления идентификацией (IMS), которая также является службой WCF, работающей на сервере qa, а не моей локальной машиной. Вебсервис может успешно подключиться к службе IMS. Я пытаюсь использовать одну и ту же привязку для подключения к службе агента. Насколько я могу сказать, адрес, привязка и контракт совпадают между веб-сервисом и агентом, но я все равно получаю исключение EndPointNotFoundException. Что я пропустил?

Вот раздел system.serviceModel из web.config для веб-сервиса:

<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> 

Вот раздел system.serviceModel из app.config для службы агента:

<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 с установленными точками останова. Нужно ли устанавливать сервис, а затем присоединяться к процессу?

ответ

0

Ну, проблема заключалась в том, что в конфигурационном файле этого приложения есть приложение appSetting, которое контролирует создание или отсутствие службыhosthost, а параметр был установлен на false. Не могу сказать, почему в конфигурационном файле есть такая настройка. Однако установка appSetting в true просто показала совершенно новую проблему. Итак, к следующей проблеме.