J'ai une bibliothèque de services WCF avec netTcpBinding. Son app.config comme suit:Bibliothèque de services WCF - Effectuer des appels à partir de l'application Console
<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>
Je veux l'appeler à partir d'une application console à des fins de test.
Je comprends que je peux appeler en ajoutant une référence de service ou en ajoutant un proxy en utilisant svcutil. Mais dans les deux cas, mon service doit être opérationnel (j'ai utilisé WCF Test Client)
Existe-t-il un autre moyen d'appeler et de tester la méthode de service à partir de l'application console?
Merci pour votre réponse. J'ai utilisé WCF Test Client uniquement pour rendre mon service opérationnel, afin que deux méthodes puissent fonctionner. À certains endroits, j'ai vu l'exemple de l'utilisation de ServiceHost, même si je ne sais pas comment cela fonctionnera dans une application console. – iniki
juste une note de plus que je ne peux pas utiliser WCF Test Client directement car il ne prend pas les paramètres de configuration pour et j'ai besoin de les changer à chaque instanciation. Alors cherchait un autre moyen de l'accueillir. –
iniki