2012-03-24 2 views
3

내 이전 질문은 wcf를 편안한 서비스로 바꿔 놓았습니다. convert a WCF Service, to a RESTful application?, 어떤 도움을 받아야합니다!wcf/rest를 청취하는 엔드 포인트 없음

하지만 내 클라이언트에서 새로운 문제로 실행하고 있습니다 :

화면 덤프에서 볼 수 있듯이

There was no endpoint listening at http://localhost:26535/Service1.svc that could accept the message.
This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.

이제 편안한 서비스를 실행 :

enter image description here

그리고 추가 할 수 있습니다 url의 값 1은 다음과 같습니다.

enter image description here

,

그러나 아직 내가 비주얼 스튜디오의 또 다른 새로운 인스턴스에서 실행하는 것 어차피 내 클라이언트의 app.config는 다음과 같습니다

<?xml version="1.0" encoding="utf-8" ?> 
<configuration> 
    <system.serviceModel> 
     <bindings> 
      <customBinding> 
       <binding name="WebHttpBinding_IService1"> 
        <textMessageEncoding maxReadPoolSize="64" maxWritePoolSize="16" 
         messageVersion="Soap12" writeEncoding="utf-8"> 
         <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" 
          maxBytesPerRead="4096" maxNameTableCharCount="16384" /> 
        </textMessageEncoding> 
        <httpTransport></httpTransport> 
       </binding> 
      </customBinding> 
     </bindings> 
     <client> 
      <endpoint address="http://localhost:26535/Service1.svc" binding="customBinding" bindingConfiguration="WebHttpBinding_IService1" 
       contract="ServiceReference1.IService1" name="WebHttpBinding_IService1" /> 
     </client> 
    </system.serviceModel> 
</configuration> 

클라이언트 코드 :

namespace WindowsFormsApplication1 
{ 
    public partial class Form1 : Form 
    { 
     public Form1() 
     { 
      InitializeComponent(); 
     } 

     private void Form1_Load(object sender, EventArgs e) 
     { 

     } 

     public ServiceReference1.Service1Client testClient = new ServiceReference1.Service1Client(); 
     private void button1_Click(object sender, EventArgs e) 
     { 
      label1.Text = testClient.GetData(Convert.ToInt32(textBox1.Text)); 
     } 
    } 
} 

내가 이전 문제보고 있었다 이 지역의 여기에서 : WCF - "There was no endpoint listening at..." error

그러나 해결책을 제공하지 않습니까? IIS에 대한 호스팅에 익숙하지 않거나 그렇지 않은 경우에는 디버그 (F5)에서 작동하는 것이 좋을 것입니다.

+0

내부 예외는 무엇입니까? 그것은 이것에 대해 더 많은 것을 밝힐 수 있습니다. –

+0

내부 예외를 수행하면 원격 서버에서 오류를 반환했습니다. (404) 찾을 수 없습니다. –

답변

2

실제로 이는 REST 서비스가 변경되었을 수 있습니다.

시도/제거 호스트 설정에서이 주석이

<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/> 

당신이 다음 서비스 참조를 재설정하면 그 나머지는 메타 데이터합니다 (MEX의 따라서 제거)

를 통해 전달하지 않는 것 같다 , 제대로 작동해야합니다 ... 나는 믿습니다. 당신이 제 3 자 사용 할 수있는 경우 또한

, this article는 내가 RestSharp을 사용하는 것이 좋습니다 것

유용 할 수 있습니다. 그것은 RESTful 서비스를 매우 쉽게 소모하게 만든다.

아니면 더 직접적인 호출을 할 수있는 최신 WebAPI를 사용할 수 있는가? 문제는 RESTful 서비스가 SOAP 호출의 방식대로 쉽게 소비되지 않는다는 것입니다.

+0

내 클라이언트의 바인딩을 webhttpbinding으로 변경하면 다음과 같은 이유로 service reference에 대한 config를 업데이트 할 수없는 servicereference를 업데이트하는 중 오류가 발생합니다 : 'system.servicemodel/binding/webhttpbinding'의 맹목적인 'webhttpbindig_Iservice1'라는 이름의 구성 바인딩은 app.config 줄 17에서 –

+0

의 값 바인딩입니다. OK, customBinding을 다시 넣으십시오. 그러나 서비스에서 mex를 유지하고 무슨 일이 일어나는 지보십시오.) ... ...이 기사 또한 내가 GET을 지금 찾고있을 때 이것이 여전히 POST를 보내고 있다고 믿게한다. http://forums.asp.net/t/1695037.aspx/1 보내지는 것을보기 위해 피 들러를 사용할 수 있는가? 전선을 가로 질러? –

+1

사실, 무엇보다. RestSharp를 살펴 보는 것이 좋습니다.나는 당신이 그것을 사용할 수 있는지 확신 할 수 없지만, REST 서비스를 매우 간단하게 만든다. –

관련 문제