[Mono-list] WCF certificate security with Mono

Michael Stoll unwichtig2 at mistoll.de
Fri Jul 22 16:03:46 EDT 2011


I'm trying to migrate an existing application to Mono (v2.10.2).

Therefore I created a test WCF service with BasicHttpBinding and message 
security. The client works perfectly with .NET, but when running with 
Mono it fails.

The client factory is instantiated as follows:

|
var  certificate=  new  X509Certificate2("certificate.pfx",  "password");

var  binding=  new  BasicHttpBinding();
binding.Security.Mode  =  BasicHttpSecurityMode.Message;
binding.Security.Message.ClientCredentialType  =  BasicHttpMessageCredentialType.Certificate;

var  epa=  new  EndpointAddress(
     new  Uri("http://localhost:53076/Service1.svc"),
     new  X509CertificateEndpointIdentity(certificate));

var  factory=  new  ChannelFactory<IService1>(binding,  epa);
factory.Credentials.ServiceCertificate.DefaultCertificate  =  certificate;
factory.Credentials.ServiceCertificate.Authentication.CertificateValidationMode  =  X509CertificateValidationMode.None;
factory.Credentials.ServiceCertificate.Authentication.RevocationMode  =  X509RevocationMode.NoCheck;
factory.Credentials.ClientCertificate.Certificate  =  certificate;

var  client=  factory.CreateChannel();
|

In Mono the application fails within CreateChannel throwing the exception:

    System.InvalidOperationException: The binding does not support any
    of the channel types that the contract 'IService1' allows.

I debugged into the Mono source code and found out that the problem is 
that AsymmetricSecurityBindingElement.InitiatorTokenParameter == null.

I'm new to Mono, maybe you could point me to a documentation/tutorial 
which covers this topic.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-list/attachments/20110722/9565221f/attachment.html 


More information about the Mono-list mailing list