Getting a WCF service (both host/client) to work on https on Linux with Mono -


i have small test console application serves wcf host , console application serves client.

the client can reach host via http, works fine far. when switching https, following error:

error: system.net.webexception: error: sendfailure (error writing headers) ---> system.net.webexception: error writing headers ---> system.io.ioexception: authentication or decryption has failed. ---> mono.security.protocol.tls.tlsexception: authentication or decryption has failed. ... 

the steps far have attempted solve issue:

  • i have verified ca-certificates-mono package installed
  • i have imported ca certs machine store (why need if work selfsigned cert?)

    sudo mozroots --import --machine --sync

  • i created selfsigned cert testing (as described in mono security faq)

    makecert -r -eku 1.3.6.1.5.5.7.3.1 -n "cn=cert4ssl" -sv cert.pvk cert.cer

  • i added mono cert store

    sudo certmgr -add -c -m trust cert.cer

    i have did tests other stores (root, my) , using not maching user's store - none did work, same error on each attempt

  • i assigned port service uses cert

    httpcfg -add -port 6067 -cert cert.cer -pvk cert.pvk

  • i added ignoring certificate validation

    servicepointmanager.servercertificatevalidationcallback += (o, certificate, chain, errors) => true;

    this did not either (but got called, cert object looked allright in debugger).

the client uses code call webservice:

iservice svcclient2 = null; string address2 = "https://localhost:6067/testservice"; basichttpbinding httpbinding2 = new basichttpbinding(); httpbinding2.transfermode = transfermode.buffered; httpbinding2.security.mode = basichttpsecuritymode.transport; httpbinding2.security.transport.clientcredentialtype = httpclientcredentialtype.none; httpbinding2.messageencoding = wsmessageencoding.text; httpbinding2.usedefaultwebproxy = true; channelfactory<iservice> channelfac2 = new channelfactory<iservice>( httpbinding2, new endpointaddress( address2 ) ); svcclient2 = channelfac2.createchannel(); string res2 = svcclient2.testhello( "bob" );   // <----- exception 

any appreciated, feel running in circles.

a few infos environment: using ubuntu 14.04 lts , mono 4.0.2, ide monodevelop

edit: have built same projects visual studio , c#, there works expected. client can connect host on both http , https. if copy on mono version windows machine, run same issue , error message on ubuntu.

could mono-related issue?


Comments