私は、WCFサービスはホストからWCFサービスにデータを取得/設定できますか?
どのような方法がWindowsServiceHostにWCFServiceからデータを取得あり(WindowsFormsApp <> WindowsServiceHostを通信する)WindowsServiceHost上でホストされていますか? そして、他の方法で(WCFServiceへWindowsServiceHostから設定データ)
私が何を行っているされて:、
- 私はWCFサービスライブラリのプロジェクトを作った実装されたインタフェース、契約など
-
:#1から突出すると<system.serviceModel> <bindings> <netTcpBinding> <binding name="netTcp"> <security mode="Message"> </security> </binding> </netTcpBinding> </bindings> <behaviors> <serviceBehaviors> <behavior name="mexBehavior"> <serviceMetadata httpGetEnabled="true"/> </behavior> </serviceBehaviors> </behaviors> <services> <service behaviorConfiguration="mexBehavior" name="KSPDJOBWinWCFService.KSPDJOBWinWCFService" > <endpoint address="KSPDJOBWinWCFService" binding="netTcpBinding" contract="KSPDJOBWinWCFService.IKSPDJOBWinWCFService" bindingConfiguration="netTcp" /> <host> <baseAddresses> <add baseAddress="http://localhost:8079"/> <add baseAddress="net.tcp://localhost:8090"/> </baseAddresses> </host> </service> </services>
設定さapp.confをSystem.ServiceModelするには、Windowsサービスと追加された参照 - 私は、新しいプロジェクトを作成しました私は、Windowsサービス
protected override void OnStart(string[] args) { host = new ServiceHost(typeof(KSPDJOBWinWCFService.KSPDJOBWinWCFService)); host.Open(); }
ののOnStartメソッドでWCFを主催しました
は(WCFクライアントなど)WinformsClientアプリで新しいソリューションを追加し、通信をテスト - すべての作業罰金を。
問題は、私はWinFormsClientからWCFサービスに値を送信した場合で、Windowsサービスaplicationから任意のヘルプのための
おかげで、それを読みたいです。
あなたが実装したWindowsサービス( 'ServiceBase'によって派生した別のサービス)の中にあなたのWCFサービスをホストしていますか?そして、あなたがデータを交換したいと思うそれらのサービスの間で、それは正しいですか?もしそうなら、WCFサービスのホスティング方法をコードに貼り付けることができますか? – Marc
こんにちはマーク私はあなたに答えました – Endriu