Ich versuche, One Way-Kommunikation mit WCF-Dienst (NetTcpBinding) zu erstellen, aber es scheint nicht zu funktionieren.OneWay-Kommunikation mit NetTcpBinding mit C#
Schnittstelle:
[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);
}
Service:
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();
Auftraggeber:
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();
}
Wenn ich WCF-Client von ASP.net Seite nenne es bis Abschluss des Prozesses warten. Bitte hilf mir, was ich vermisse. Außerdem verwende ich bis jetzt keine Konfiguration für Service/Endpunkt.
In einer Hinsicht Kommunikation wcf Client soll nicht auf den Server warten, um die Ausführung abzuschließen. Das ist das Hauptproblem.
Irgendwelche Fehlermeldung oder irgendetwas? –
Tom, es geht nicht um Fehler. Aber WCF-Client sollte nicht warten, wenn ich isOneWay = true habe. Aber mit dem obigen Code wartet der WCF-Client, bis der Server antwortet. –