У меня возникла проблема с использованием веб-службы (C# .net) из службы WCF. Ошибка, которую я получаю, это EndPointNotFoundException «Код ошибки TCP10061: соединение не может быть сделано, потому что целевая машина активно отказалась от него»Вызов webservice из службы WCF
Я написал модульный тест, чтобы проверить, могу ли я отправить запрос в веб-службу, и это хорошо работает [Единичный тест использует ту же конфигурацию привязки, что и моя служба WCF]
Веб-служба и служба WCF (клиент) имеют привязку basichttp.
Был ли у кого-нибудь подобный вопрос, вызывающий веб-сервис из службы WCF?
Модель раздела услуг выглядит следующим образом
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="DataService" closeTimeout="00:05:00" openTimeout="00:05:00" receiveTimeout="00:10:00" sendTimeout="00:05:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384"/>
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None" realm=""/>
<message clientCredentialType="UserName" algorithmSuite="Default"/>
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://10.22.33.67/Service/DataService.asmx" binding="basicHttpBinding"
bindingConfiguration="DataService" contract="Service.DataService" name="DataService"/>
</client>
<services>
<service name="TestToConsumeDataService.WCFHost.Service1" behaviorConfiguration="TestToConsumeDataService.WCFHost.Service1Behavior">
<!-- Service Endpoints -->
<endpoint address="" binding="basicHttpBinding" contract="TestToConsumeDataService.WCFHost.IService1">
<!--
Upon deployment, the following identity element should be removed or replaced to reflect the
identity under which the deployed service runs. If removed, WCF will infer an appropriate identity
automatically.
-->
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="TestToConsumeDataService.WCFHost.Service1Behavior">
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="true"/>
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
Тестовый проект Устройство также использует ту же модель обслуживания секции и она работает. Единственная проблема заключается в вызове службы из другой службы WCF. Не могли бы вы предложить.
Если вы хотите быстро проверить, используйте WcfTestClient http://msdn.microsoft.com/en-us/library/bb552364.aspx. Если это работает, тогда ваш код должен работать. – Philippe