在wsdualhttpbinding中保留回调通道

时间:2014-01-16 03:27:46

标签: .net wcf

我有一个WCF服务(使用wsdualhttpbinding复制)和一个与之通信的Web应用程序。

当客户端调用方法(比如A())async时,服务包含2个或更多方法,该方法创建一个对象(可能需要2到5分钟)。该对象包含唯一的ID。我会保留一本字典<CallbackChannel, uniqueID>

如果有任何与创建的对象有关的事件,我将不得不通知相应的客户端。我正在根据对象的唯一ID获得回调通道。

问题在于持久化客户端的回调通道。我想知道我可以以什么格式存储频道(在db中)。以及如何在需要时重新创建频道。

我设法使用以下语句基于地址和绑定创建Web应用程序的回调通道。

 Binding binding = new BasicHttpBinding();
 ICallback callBkClient = ChannelFactory<ICallback>.CreateChannel(binding, new      EndpointAddress(clientAdress));


 callBkClient.Notify("Wow");

我得到例外:

The content type text/html; charset=utf-8 of the response message does not match the content type of the


binding (text/xml; charset=utf-8). If using a custom encoder, be sure that the IsContentTypeSupported method


is implemented properly.

0 个答案:

没有答案