WCFサービス(NetTcpBinding)と片方向通信を作成しようとしていますが、動作していないようです。NetTcpBindingを使用したOneWay通信C#
インタフェース:
[ServiceKnownType(typeof(ProcessParameter))]
[ServiceKnownType(typeof(string))]
[ServiceContract]
public interface IExecServiceHost
{
[OperationContract(IsOneWay = true)]
void ExecBPWithPP(ISysObject _caller, UserEntity _currentUser, string _bpName, IProcessParameter _parameter, string _afterBP);
[OperationContract(IsOneWay = true)]
void ExecBPWithNVC(ISysObject _caller, UserEntity _currentUser, string _bpName, Dictionary<string, string> _parameter, string _afterBP);
}
サービス:
Uri[] serviceURL = new Uri[] { new Uri(ExecBPEndPointURL) };
ServiceHost host;
host = new ServiceHost(typeof(ExecServiceHost), serviceURL);
host.AddServiceEndpoint(typeof(IExecServiceHost), new NetTcpBinding(), "ExecBP");
host.Open();
Console.ReadKey();
host.Close();
クライアント:
using(ChannelFactory<IExecServiceHost> httpFactory = new ChannelFactory<IExecServiceHost>(
new NetTcpBinding(),
new EndpointAddress(ExecBPEndPointURL)))
{
IExecServiceHost httpProxy = httpFactory.CreateChannel();
Dictionary<string, string> serviceBPParam = new Dictionary<string, string>(StringComparer.InvariantCultureIgnoreCase);
foreach(string key in _parameter.Keys)
serviceBPParam.Add(key, _parameter[key]);
httpProxy.ExecBPWithNVC(_caller, _currentUser, _bpName, serviceBPParam, _afterBP);
httpFactory.Close();
}
私はそれが処理完了まで待つASP.netページからWCFクライアントを呼び出しています。私が逃しているものを手伝ってください。 また、これまでのところ、サービス/エンドポイントには設定を使用していません。
通信のwcfクライアントは、wcfサーバーが実行を完了するのを待つことは想定されていません。これが主な問題です。
エラーメッセージなどありますか? –
トム、それは誤りではない。しかし、wcfクライアントは、isOneWay = trueのときに待つべきではありません。しかし、上記のコードでは、wcfクライアントはwcfサーバーが応答するまで待っています。 –