2012-12-14 1 views
2

간단한 WCF 서비스를위한 콘솔 기반 호스트가 가장 단순합니다. 서비스에 대한 응용 프로그램의 설정은 다음과 같습니다 ** 콘솔 기반 WCF 호스트 *가장 간단한 콘솔 호스팅 WCF 서비스는 탐색 할 때 404를 생성합니다.

***** Host Info ****** 
Address: http://localhost:8080/MagicEightBallService 
Binding: BasicHttpBinding 
Contract: IEightBall 

Address: http://localhost:8080/MagicEightBallService/mex 
Binding: MetadataExchangeHttpBinding 
Contract: IMetadataExchange 

************************************************** 
The service is ready 

을 내가 찾아 보거나 생성하려고하면 :

<system.serviceModel> 
    <services> 
     <service name="MagicEightBallServiceLib.MagicEightBallService" 
       behaviorConfiguration="EightBallServiceMEXBehavior"> 
     <endpoint address="" 
        binding = "basicHttpBinding" 
        contract = "MagicEightBallServiceLib.IEightBall" /> 
     <!-- Enable the MEX endpoint--> 
     <endpoint address="mex" 
       binding ="mexHttpBinding" 
       contract ="IMetadataExchange" /> 
     <!--Need to add this so MEX knows the address of our service --> 
     <host> 
     <baseAddresses> 
      <add baseAddress="http://localhost:8080/MagicEightBallService"/> 
     </baseAddresses> 
     </host> 
     </service> 
    </services> 
    <behaviors> 
     <serviceBehaviors> 
     <behavior name="EightBallServiceMEXBehavior"> 
      <serviceMetadata httpGetEnabled="true"/> 
     </behavior> 
     </serviceBehaviors> 
    </behaviors> 
    </system.serviceModel> 

호스트 프로그램은 완벽하게 실행 보여줍니다 프록시 얻을 : HTTP 오류 404.0 - 찾을 수 없습니다.

무엇이 잘못되었는지 알 수 없습니다. 이보다 더 간단한 것을 얻을 수 없습니다!

답변

0

나는 Troelsen의 책을 읽을 때 같은 문제에 봉착했으며 온라인에서 답변을 찾을 수 없습니다. 어쨌든 문제는 MagicEightBallLib의 프로젝트 유형에있는 것 같습니다. Troelsen은 Visual C# -> Windows -> 클래스 라이브러리 프로젝트를 만들 것을 제안하지만 그 작업을 위해 수정해야 할 사항을 설명하지는 않습니다. 대신 Visual C# -> WCF -> WCF 서비스 라이브러리 프로젝트를 사용하면 WcfTestClient.exe가 자동으로 시작되고 "WCF 옵션"이라는 프로젝트 환경 설정에 새 탭이 추가됩니다. 두 유형의 프로젝트 모두에서 .csproj 파일의 차이점을 비교하려고 시도했지만 너무 많습니다. 솔루션은 Class Library 대신 WCF Service Library 프로젝트 유형으로 시작하여 인터페이스 및 클래스 이름을 책에 맞게 조정합니다.

.csproj 파일의 특정 부분에서이 기능을 활성화하는 부분을 알고 있다면 누구나이 내용을 듣고 싶습니다.

희망이 도움이됩니다.

0

localhost : 8080을 사용하는 대신 127.0.0.1:8080을 사용하십시오. 이것이 Windows 10 컴퓨터에서 작동하는 예입니다.

관련 문제