2009-11-12 2 views
0

에서 통화를 할 수. 그것의 app.config는 다음과 같이WCF 서비스 라이브러리 - 내가 netTcpBinding와 WCF 서비스 라이브러리가 콘솔 응용 프로그램

<configuration> 
<system.serviceModel> 
<bindings> 
    <netTcpBinding> 
    <binding name="netTcp" maxBufferPoolSize="50000000" maxReceivedMessageSize="50000000"> 
     <readerQuotas maxDepth="500" maxStringContentLength="50000000" maxArrayLength="50000000" maxBytesPerRead="50000000" maxNameTableCharCount="50000000" /> 
     <security mode="None"></security> 
    </binding> 
    </netTcpBinding> 
</bindings> 

<services> 
    <service behaviorConfiguration="ReportingComponentLibrary.TemplateServiceBehavior" 
    name="ReportingComponentLibrary.TemplateReportService"> 
    <endpoint address="TemplateService" binding="netTcpBinding" bindingConfiguration="netTcp" 
     contract="ReportingComponentLibrary.ITemplateService"></endpoint> 
    <endpoint address="ReportService" binding="netTcpBinding" bindingConfiguration="netTcp" 
     contract="ReportingComponentLibrary.IReportService"/> 
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" ></endpoint> 

    <host> 
     <baseAddresses> 
     <add baseAddress="net.tcp://localhost:8001/TemplateReportService" /> 
     <add baseAddress ="http://localhost:8080/TemplateReportService" /> 
     </baseAddresses> 
    </host> 
    </service> 
</services> 

<behaviors> 
    <serviceBehaviors> 
    <behavior name="ReportingComponentLibrary.TemplateServiceBehavior"> 
     <serviceMetadata httpGetEnabled="True"/> 
     <serviceDebug includeExceptionDetailInFaults="True" /> 
    </behavior> 
    </serviceBehaviors> 
</behaviors> 
</system.serviceModel> 
</configuration> 

내가 테스트 목적으로 콘솔 응용 프로그램에서 호출 할.
서비스 참조를 추가하거나 svcutil을 사용하여 프록시를 추가하여 전화 할 수 있음을 이해합니다.
그러나이 두 경우 모두에서, 내 서비스는 위 (나는 WCF 테스트 클라이언트를 사용)

콘솔 응용 프로그램에서 다른 내가 호출 할 수있는 방법 및 테스트 서비스 방법은 거기에 실행 할 필요가?

답변

0

테스트를 위해 당신은 당신의 WCF 서비스를 호스팅하는 WcfSvcHost.exe를 사용할 수 있습니다. 그것에 메소드를 호출하기 위해 당신은 당신이 WcfTestClient.exe

+0

답장을 보내 주셔서 감사합니다. WCF Test Client를 사용하여 내 서비스를 실행하고 위의 두 가지 방법으로 작업 할 수 있습니다. 어떤 곳에서는 ServiceHost를 사용하는 예도 보았습니다. 콘솔 응용 프로그램에서 작동하는 방법을 잘 모르는 경우도 있습니다. – iniki

+0

WCF Test Client는 에 대한 구성 설정을 취하지 않으므로 직접 사용할 수 없으며 모든 인스턴스화마다이를 변경해야합니다. 그래서 그것을 호스트하는 다른 방법을 찾고있었습니다. – iniki

0

사람들은 내가 생각할 수있는 유일한 방법입니다 사용할 수있는 클라이언트가 필요하지 않습니다. 그러나, 내 웹 서비스 모듈은 일반적으로 매우 얇은, 다른 .NET 모듈로 그냥 간단한 메서드를 호출합니다. 콘솔 응용 프로그램에서 동일한 호출을 만들 수 있습니다. 또는 너무 많이 노출되는 경우 콘솔 응용 프로그램에 대한 동일한 호출을 제공하는 다른 .NET DLL을 만들 수 있습니다. 그 자체로 "웹 서비스"(하중 부담 등)를 테스트 할 수는 없지만 여전히 기능을 테스트 할 것입니다.