私はこのチュートリアルに従いました(少なくともこれに基づいて、同じように作業する必要があります): http ://www.eggheadcafe.com/tutorials/wcf/b5ada8df-58c5-492f-b368-457b3a4f137c/notify-client-アプリケーション-using-wcf-callbacks.aspx
私のコンピューターでは非常にうまく機能していますが、インターネット経由で使用する必要があります。これを行おうとしているときに、netTcpBidingを使用する方が良いと(インターネット経由で)聞いた。
オンラインのクライアント数を認識するサーバーを用意します。サーバーのIISでWFCサービスを使用し、Windowsサービスがそれを使用して通知する必要がありました。サーバーがクライアントでいくつかのコマンドを実行できるようにする必要がある場合は、コールバックが必要です。
誰かが私を助けてくれたらとても嬉しいです。
前もって感謝します、
編集:
自分自身を明確にする:私はそれをインターネット上で機能させることができませんでした。netTcpBindingを使用してインターネット上で動作するように構成(Web.config e App.config)を変更する方法を教えてもらえますか?
再度、感謝します、
編集2:
WCFServiceApplicationのWeb.configは次のとおりです。
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<system.serviceModel>
<bindings>
<wsDualHttpBinding>
<binding name="WSDualHttpBinding_IPCWatcherWCFService" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00" />
<security mode="Message">
<message clientCredentialType="Windows" negotiateServiceCredential="true" algorithmSuite="Default" />
</security>
</binding>
</wsDualHttpBinding>
</bindings>
<services>
<service behaviorConfiguration="TiT.PCWatcher.Server.WCFService.Services.PCWatcherWCFServiceBehavior" name="TiT.PCWatcher.Server.WCFService.Services.PCWatcherWCFService">
<endpoint address="" binding="wsDualHttpBinding" bindingConfiguration="WSDualHttpBinding_IPCWatcherWCFService" contract="TiT.PCWatcher.Server.WCFService.Interfaces.IPCWatcherWCFService">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="TiT.PCWatcher.Server.WCFService.Services.PCWatcherWCFServiceBehavior">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>
WindowsServiceのApp.configは次のとおりです。
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<bindings>
<wsDualHttpBinding>
<binding name="WSDualHttpBinding_IPCWatcherWCFService" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text"
textEncoding="utf-8" useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00" />
<security mode="Message">
<message clientCredentialType="Windows" negotiateServiceCredential="true"
algorithmSuite="Default" />
</security>
</binding>
</wsDualHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:25145/Services/PCWatcherWCFService.svc"
binding="wsDualHttpBinding" bindingConfiguration="WSDualHttpBinding_IPCWatcherWCFService"
contract="PCWatcherWCFServiceReference.IPCWatcherWCFService"
name="WSDualHttpBinding_IPCWatcherWCFService">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
</client>
</system.serviceModel>
</configuration>
netTcpBindingに変更するだけでは機能しません...
しかし、これをインターネット上で実行できることを嬉しく思います...私はIISでWCFServiceを公開しました。リンク:
https://www2.tcenter.com.br/monitor/PCWatcherWCFService.svc
また
http://www2.tcenter.com.br:8080/monitor/PCWatcherWCFService.svc
設定を変更するだけで、インターネット経由で機能するようになりますか?私が言ったように、ローカルでは問題なく動作します。
クライアントのエンドポイントアドレスを上記のURLのいずれかに変更するだけでうまくいくと思いましたが、うまくいきませんでした...
リンクした例は、WPFでサービスをホストします。それが私の風景に当てはまるかどうかはわかりません...
DualHttpBindingを使い続けるつもりだと思いますが、ポートフォワーディングが私のニーズに適しているとは思わないでしょう。1つのイントラネットに多数のクライアントを配置し、ルーターに情報を送信するクライアントを決定させることができます。それは良くないですよね?または、同じポートを介してWebサーバーに接続しているすべてのマシンにルーターが正しく応答するようにする方法はありますか?!(ただ尋ねる、hehehe)
よろしくお願いします、
2012年6月21日に編集:
読んでくれてありがとう。LANのnetTcpBindingでサービスを動作させることができませんでした。私は自分のシーナリオの模擬サンプルを作成しました。ここにあります。DualCommunicationTestと呼ばれます。
この投稿を始めたとき、私はこのセナリオンをインターネット上で実行する方法を知りたかっただけです。それだけ。ここに投稿する前に解決策を探していたときに、netTcpBindingの方が優れていることを読みました。それで私はそれについて尋ねました。それは単なる副次的な質問でした。
だから...私の現在の投稿のニーズは次のとおりです。
インターネットで開発したサンプルの使い方。
また
私が開発したサンプルをnetTcpBindingで動作させ、インターネットで使用できるようにする方法。(Clunky Coderが、IISなどを使用してインターネット上でnet.tcpを公開する方法について、第2部を教えてくれたと確信しています。ありがとうございましたが、テストできなかったため、まだテストできませんでした。まだnetTcpを実行していません。)
よくわからなくてごめんなさい、私の英語はあまり上手ではありません。どうもありがとうございました。