Thanks, that seemed to be working :)
On Jun 1, 9:42 pm, Craig Neuwirt <[email protected]> wrote:
> You should be able to achieve the same thing by registering an
> implementation of IChannelFactoryAware and doing your
> channelFactory.Credentials.Windows.AllowedImpersonationLevel =
> TokenImpersonationLevel.Impersonation;
> channelFactory.Credentials.Windows.AllowNtlm = true;
>
> in the Create method
>
> On Mon, Jun 1, 2009 at 1:23 PM, Huseyin Tufekcilerli
> <[email protected]>wrote:
>
>
>
>
>
> > I am trying to set the a ClientCredentials IEndpointBehavior on my WCF
> > client (1) but when I try to resolve a proxy of contract type
> > ICustomerService, I get the following exception:
>
> > The value could not be added to the collection, as the collection
> > already contains an item of the same type:
> > 'System.ServiceModel.Description.ClientCredentials'. This collection
> > only supports one instance of each type.
> > Parameter name: item
>
> > (obviously this behavior is a built-in one on ChannelFactory<T> and
> > doesn't let me put another one)
>
> > // CODE *****************************************
> > var binding = new NetTcpBinding();
> > binding.Security.Mode = SecurityMode.Transport;
> > binding.Security.Transport.ClientCredentialType =
> > TcpClientCredentialType.Windows;
>
> > // (1) *****************************************
> > var clientCredentials = new ClientCredentials();
> > clientCredentials.Windows.AllowedImpersonationLevel =
> > TokenImpersonationLevel.Impersonation;
> > clientCredentials.Windows.AllowNtlm = true;
> > // (1) *****************************************
>
> > var address = new EndpointAddress(
> > new Uri("net.tcp://host.domain.com:8182/Mind2Biz/
> > CustomerService"),
> > EndpointIdentity.CreateSpnIdentity("CustomerService/
> > host.domain.com"));
>
> > var clientModel = DefaultClientModel.On(WcfEndpoint
> > .ForContract<ICustomerService>()
> > .BoundTo(binding)
> > .At(address));
>
> > var container = new WindsorContainer()
> > .AddFacility<WcfFacility>()
> > .Register(
> > // (1) *****************************************
> > Component.For<ClientCredentials>().Instance
> > (clientCredentials),
> > // (1) *****************************************
> > Component.For<ICustomerService>().ActAs
> > (clientModel).LifeStyle.Transient
> > );
>
> > // (2) *****************************************
> > var proxy = container.Resolve<ICustomerService>();
> > // (2) *****************************************
>
> > Normally, without Castle WCF Facility, I would set that already
> > existing
> > Credentials on channel factory like this:
>
> > var channelFactory = new ChannelFactory<ICustomerService>(binding,
> > endpointAddress);
> > channelFactory.Credentials.Windows.AllowedImpersonationLevel =
> > TokenImpersonationLevel.Impersonation;
> > channelFactory.Credentials.Windows.AllowNtlm = true;
>
> > How can I modify this existing ClientCredentials on my WCF Channel
> > Factory using Castle WCF Facility? Thanks!
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---