У нас есть служба wcf, которая работает по привязке net tcp и имеет контракт на обратный вызов.
Когда я пытаюсь вызвать сервисный метод, используя дуплексный прокси-канал, получаю следующую ошибку. служба работает, но не может подключиться через прокси-клиент.
C #
this.Invoke(p => p.Subscribe(), true);
public void Invoke(Action<T> call, bool keepOpen)
{
T proxy = GetProxy();
call(proxy);
}
public T GetProxy()
{
NetTcpBinding binding = new NetTcpBinding("");
EndpointAddress address = new EndpointAddress(new Uri("net.tcp://" + Server + RelativeUrl), EndpointIdentity.CreateSpnIdentity(Server + "/" + Environment.MachineName));
factory = new DuplexChannelFactory<T>(new InstanceContext(callbackInstance), binding, address);
T proxy = factory.CreateChannel();
((IClientChannel)proxy).Open();
return proxy;
}
сервис
[ServiceContract(SessionMode = SessionMode.Required, CallbackContract = typeof(IWorkflowChanged))]
public interface IWorkflowChangedPublisher
{
[OperationContract(IsOneWay = false)]
void Subscribe();
}
public interface IWorkflowChanged
{
[OperationContract(IsOneWay = true)]
void WorkflowChanged(WorkflowChangedEventArgs args);
}
Получение следующего исключения:
Server stack trace:
at System.ServiceModel.Dispatcher.DuplexChannelBinder.SyncDuplexRequest.WaitForReply(TimeSpan timeout)
at System.ServiceModel.Dispatcher.DuplexChannelBinder.Request(Message message, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at Tradar.Workflow.Service.IStatusPublisher.Subscribe()
at Tradar.Workflow.StatusMonitor.<>c.<Open>b__16_0(IStatusPublisher p) in D:\PMARepo\backoffice\Insight\Modules\Workflow\Core\StatusMonitor.cs:line 139
at Tradar.Workflow.ProxyFactory`1.Invoke(Action`1 call, Boolean keepOpen) in D:\PMARepo\backoffice\Insight\Modules\Workflow\Core\ProxyFactory.cs:line 79