ppcanodehuelva
unread,Jan 3, 2009, 1:57:47 PM1/3/09Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Castle Project Users, cneu...@gmail.com
Hi,
i began to register some wcf proxy/client in the container.
Before, I was using the proxies and accessing the OperationContext in
such way:
ICrudTransferFactory p =
ChannelFactory<ICrudTransferFactory>.CreateChannel(new BasicHttpBinding
(), new EndpointAddress(_endpointAddress));
using (new OperationContextScope((IContextChannel)p))
{
OperationContext.Current.OutgoingMessageHeaders.Add
(MessageHeader.CreateHeader(CrudTransfer.HeaderIdName,
CrudTransfer.HeaderIdNamespaceUri, new CrudHeader(sid)));
Endpoint e = _proxy.Place(new CrudItem("ex1"));
}
-------------------------------------------------------------------------------------
When the container retrieves the proxy, such proxy cannot be casted to
IContextChannel (System.InvalidCastException comes out)
component 'crudfactory_proxy', ICrudTransferFactory:
ClientModel = DefaultClientModel( WcfEndpoint.BoundTo(_binding).At
(_crudFactoryEA) )
ICrudTransferFactory castleProxy =
_container.Resolve<ICrudTransferFactory>("crudfactory_proxy");
using (new OperationContextScope((IContextChannel)
castleProxy))
{
OperationContext.Current.OutgoingMessageHeaders.Add
(MessageHeader.CreateHeader(CrudTransfer.HeaderIdName,
CrudTransfer.HeaderIdNamespaceUri, new CrudHeader(sid)));
Endpoint e = castleProxy.Place(new CrudItem
("ex2"));
}
----------------------------------------------------------
Is there a way to get the IContextChannel from the client?
Shouldn't both ClientChannels work on the same way in order the client
must not be Castle-aware?
Many thanks in advance, regards.