This is actually question that I posted to stackoverflow today and
have got no response yet:
http://stackoverflow.com/questions/5002309/using-windsor-castle-and-wcffacility-to-create-wcf-proxies-with-message-security

I also bring the question here:


OK we are using message security with username credentials (and X509
certificate encryption) to communicate with our WCF service. I am not
happy with this approach but that is not the point of question and I
do not want to get into that.

I am using Windsor Castle to generate proxies in ASP NET Web Forms +
MVC hybrid. We are using forms authentication and use user's
credentials to communicate with WCF services - this will help auditing
all calls. As I said, I am not happy with this approach but as I said
that is not the point.

I have created CustomCredentials class which inherits
AbstractCredentials class and WcfFacility happily uses it to configure
my proxies. As you will see below, all my setup is just a few lines. I
have created unit test below which demonstrates all I am doing:
creating a proxy, making a call and then releasing it in a loop. Now I
am expecting this test to work but it does not and I get

Expected: 10 But was: 1

I have not included binding but that is irrelevant, as I said I am
using Message Security with X509 certificates.

I know that for channel factory with message security, once opened you
cannot change credentials. Is this the same issue?

Is this a bug in WcfFacility or a limitation?

Here is the code

[TestFixture]
public class Harness
{

    private IWindsorContainer _container;
    public static int NumberOfTimesCredentialsConfigured = 0;

    [SetUp]
    public void Setup()
    {
        _container = new
WindsorContainer().AddFacility<WcfFacility>();

    Component
        .For<IFrameworkUsers>()
        .ActAs(DefaultClientModel
        .On(WcfEndpoint.FromConfiguration("FrameworkUsersService"))
        .Credentials(new CustomCredentials()))
        .LifeStyle.Transient);
    }

    [Test]
    public void MultipleProxyTest()
    {

        const int Runs = 10;
        NumberOfTimesCredentialsConfigured = 0;
        for (int i = 0; i < Runs; i++)
        {
            IFrameworkUsers frameworkUsers =
_container.Resolve<IFrameworkUsers>();
            frameworkUsers.CreateUserSession();
            _container.Release(frameworkUsers);
        }

-- 
You received this message because you are subscribed to the Google Groups 
"Castle Project Development List" 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-devel?hl=en.

Reply via email to