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.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Castle Project Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/castle-project-users?hl=en
-~----------~----~----~----~------~----~------~--~---