我有一个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