2010-10-28 3 views
1

Я пытаюсь использовать веб-службу ASMX из моей службы WCF. Вот что я сделал, и я получил следующую ошибку. «Не было прослушивание конечных точек на« http: // ... », которое могло бы принять сообщение, что часто вызвано неправильным адресом или действием SOAP. Дополнительные сведения см. В InnerException, если имеется, для получения более подробной информации.Потребление ASMX WebService из WCF

Please помочь мне. Где я делаю неправильно? Что мне не хватает?

Я создал библиотеку службы WCF и добавил ссылку на веб-службы ASMX с помощью файла WSDL предоставленной мне.

namespace WCFClueClient 
{ 
     public class Service1 : IService1 
    { 
     public string GetData(string value) 
     { 
     ClueClientServiceReference.InteractiveOrderHandlerClient client = new WCFClueClient.ClueClientServiceReference.InteractiveOrderHandlerClient(); 
      string response = client.handleInteractiveOrder(value); 
      return string.Format("You entered: {0}", response); 
     } 

      }

У меня есть консольное приложение, которое ссылается на мою службу WCF

namespace CLUE 
{ 
    class Program 
    { 
     static void Main(string[] args) 
     { 

      CLUETestServiceReference.Service1Client client = new CLUE.CLUETestServiceReference.Service1Client(); 

      string response = client.GetData("JOHN DOE"); 

       } 
    } 
} 

мой app.config файл

<system.serviceModel> 
<bindings> 
    <basicHttpBinding> 
    <binding name="InteractiveOrderHandlerBinding" closeTimeout="00:01:00" 
     openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01: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> 
    <wsHttpBinding> 
    <binding name="WSHttpBinding_IService1" closeTimeout="00:01:00" 
     openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" 
     bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard" 
     maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text" 
     textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false"> 
     <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" 
     maxBytesPerRead="4096" maxNameTableCharCount="16384" /> 
     <reliableSession ordered="true" inactivityTimeout="00:10:00" 
     enabled="false" /> 
     <security mode="Message"> 
     <transport clientCredentialType="Windows" proxyCredentialType="None" 
      realm="" /> 
     <message clientCredentialType="Windows" negotiateServiceCredential="true" 
      algorithmSuite="Default" establishSecurityContext="true" /> 
     </security> 
    </binding> 
    </wsHttpBinding> 
</bindings> 
<client> 
    <endpoint address="http://alalppnc079.choicepoint.net:8280/CPRules-rfCommunicationEJB/InteractiveOrderHandlerURI" 
    binding="basicHttpBinding" bindingConfiguration="InteractiveOrderHandlerBinding" 
    contract="ClueClientServiceReference.InteractiveOrderHandler" 
    name="InteractiveOrderHandlerPort" /> 
    <endpoint address="http://localhost:8731/Design_Time_Addresses/WCFClueClient/Service1/" 
    binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IService1" 
    contract="WCFCLUETEstServiceReference.IService1" name="WSHttpBinding_IService1"> 
    <identity> 
     <dns value="localhost" /> 
    </identity> 
    </endpoint> 
</client> 
<services> 
    <service name="WCFClueClient.Service1" behaviorConfiguration="WCFClueClient.Service1Behavior"> 
    <host> 
     <baseAddresses> 
     <add baseAddress="http://localhost:8731/Design_Time_Addresses/WCFClueClient/Service1/" /> 
     </baseAddresses> 
    </host> 
    <!-- Service Endpoints --> 
    <!-- Unless fully qualified, address is relative to base address supplied above --> 
    <endpoint address="" binding="wsHttpBinding" contract="WCFClueClient.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> 
    <!-- Metadata Endpoints --> 
    <!-- The Metadata Exchange endpoint is used by the service to describe itself to clients. --> 
    <!-- This endpoint does not use a secure binding and should be secured or removed before deployment --> 
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/> 
    </service> 
</services> 
<behaviors> 
    <serviceBehaviors> 
    <behavior name="WCFClueClient.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> 

+0

У вас есть ссылка как WebService? или как сборка? – pjnovas

+0

Я добавил ссылку как Webservice. – BumbleBee

ответ

1

Эй, в этом посте есть прохладное объяснение этой проблемы: Stackoverflow post

И если вы не получите проблемы. .. просто нажмите F5 на своем решении и встаньте на сайт ... затем зайдите в свой файл сборки консоли (внутри папки отладки) и выполните .exe. Кажется, что вы пытаетесь работать с хостом и клиентом webservice в том же отладчике.

Надеюсь, это поможет!

+0

Привет, Darkxes, Спасибо. Я попробовал, как ты сказал. Но моя подсказка commad закрывается сразу после ввода ввода. – BumbleBee

+0

Вот что я делаю в своей консоли WCFServiceReference.Service1Client client = new CLUE.WCFServiceReference.Service1Client(); Console.WriteLine ("Введите имя:"); string name = Console.ReadLine(); Console.WriteLine (client.GetData (имя)); Console.Read(); – BumbleBee

+0

Darkxes, Не могли бы вы помочь мне решить эту проблему. Мне нужно сделать это как можно скорее. Спасибо – BumbleBee

Смежные вопросы