我有一個WCF服務庫與netTcpBinding。它的app.config如下: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測試客戶端)
有從控制檯應用程序的任何其他方式我可以打電話和測試服務的方法?
感謝您的回覆。我一直只使用WCF Test Client來啓動和運行我的服務,以便上述兩種方法可以工作。在某些地方,我也看到了使用ServiceHost的例子,儘管我不確定它如何在控制檯應用程序中工作。 – iniki 2009-11-12 11:01:14
只需再注意一點,我不能直接使用WCF Test Client,因爲它不會採用 的配置設置,我需要在每個實例化中更改它們。所以正在尋找其他方式來主辦它。 –
iniki
2009-11-12 11:50:40