私は、netTcpBinding とコールバック メソッドを使用しているホスト/クライアント WCF サービスとクライアントを取得しました。
<bindings>
<netTcpBinding>
<binding name="tcp_Unsecured" receiveTimeout="00:01:00" sendTimeout="00:01:00">
<security mode="None" />
<reliableSession enabled="true" ordered="true" inactivityTimeout="00:10:00"/>
</binding>
</netTcpBinding>
</bindings>
プロキシー
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")]
[System.ServiceModel.ServiceContractAttribute(Namespace="http://dotnetaddict.dotnetdevelopersjournal.com/wcf.samples", ConfigurationName="AlarmServer", CallbackContract=typeof(AlarmServerCallback), SessionMode=System.ServiceModel.SessionMode.Required)]
public interface AlarmServer
{
[System.ServiceModel.OperationContractAttribute(IsOneWay=true, Action="http://dotnetaddict.dotnetdevelopersjournal.com/wcf.samples/AlarmServer/RegisterAlarm")]
void RegisterAlarm(System.DateTime alarmTime, string clientName, string reminderMessage);
[System.ServiceModel.OperationContractAttribute(IsOneWay = true, Action = "http://dotnetaddict.dotnetdevelopersjournal.com/wcf.samples/AlarmServer/unRegisterAlarm")]
void unRegisterAlarm(string clientName);
[System.ServiceModel.OperationContractAttribute(IsOneWay = true, Action = "http://dotnetaddict.dotnetdevelopersjournal.com/wcf.samples/AlarmServer/broadcastMessage")]
void broadcastMessage(string msg);
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")]
public interface AlarmServerCallback
{
[System.ServiceModel.OperationContractAttribute(IsOneWay=true, Action="http://dotnetaddict.dotnetdevelopersjournal.com/wcf.samples/AlarmServer/SignalAlarm")]
void SignalAlarm(string reminderMessage);
[System.ServiceModel.OperationContractAttribute(IsOneWay = true, Action = "http://dotnetaddict.dotnetdevelopersjournal.com/wcf.samples/AlarmServer/displayMessage")]
void displayMessage(string msg);
}
コールバックを持つクライアント インスタンス
public MainForm()
{
InitializeComponent();
InstanceContext context = new InstanceContext(new AlarmCallback());
client = new AlarmServerClient(context);
}
私が抱えている問題は、バインディングの recieveTimeout がトリガーされた後、クライアントが障害状態になり、コールバックをリッスンしているクライアントを閉じることです。
sysinternals の TCPVIEW を使用して、リッスン ポートのドロップを確認できます。
チャネルをビジー状態にしておくと、タイムアウトがトリガーされないため、サーバー/クライアントへの WCF メッセージの障害ではありません。複数のメッセージが問題なく流れます。
receiveTimeout は、TCP を介した WCF メッセージからの応答が失敗したかどうかを検出する方法を提供するように設計されていると思いましたか? 接続に問題があるのはなぜですか。タイムアウト期間中に作成されたコールバック オブジェクトがない場合、チャネルは閉じられているように見えますか?
私は何を間違っていますか?