[Mono-list] [WCF] WebHttpBinding and HTTPS: Basic Auth not working

Tobias Kolb kolb.tobias at gmail.com
Wed Jul 31 14:26:16 UTC 2013


Hi,

I'm trying to get my Windows-App running with Mono on a Linux machine
(my aim is to run it on a Raspberry Pi but for the first step I want
it just running on a normal X86 Ubuntu PC to see if it works). The App
self hosts a REST/JSON Webservice, secured with transport security
(HTTPS) and client authentication with Basic Auth (username/password).

On Windows with Microsoft .NET 4.0 everything works fine, but with
Mono I have the problem that the client authentication part seems to
be ignored. The Service provides the result pages for REST calls
without any login dialog for Basic auth displayed. I've verified that
the Validate() method of my CustomUserNameValidator implementation
never gets called. I'm using a self-signed certificate (generated by
mono makecert and bound to port 8080 with httpcfg) if that matters.

Can it be that Mono just dont't support WebHttpBinding with SSL and
Basic Auth? My Mono version is 2.10.8.1-5ubuntu1 and this is the part
that configures the hosting by code (not by app.config):

// Create the ServiceHost for Webservice
_host = new WebServiceHost(Webservice, new
Uri("https://localhost:8080/LogoControl/"));

_host.Credentials.UserNameAuthentication.UserNamePasswordValidationMode
= System.ServiceModel.Security.UserNamePasswordValidationMode.Custom;
_host.Credentials.UserNameAuthentication.CustomUserNamePasswordValidator
= new CustomUserNameValidator();

// Service Endpoint for REST
WebHttpBinding wb = new WebHttpBinding(WebHttpSecurityMode.Transport);
wb.Security.Transport.ClientCredentialType = HttpClientCredentialType.Basic;

var se = _host.AddServiceEndpoint(typeof(IRemoteControl), wb, "");
se.Behaviors.Add(new WebHttpBehavior());
_host.Open();


If I can provide any other information please let me know.

Tobias


More information about the Mono-list mailing list