.netwcfsslasynchronousduplex

Wcf duplex connection with https reply endpoint


I have a duplex Wcf connection with callback, which works ok via http, (when i use <compositeDuplex clientBaseAddress="http://localhost:8678/.."/>), but when i try to switch that adress to https ("https://localhost:8678/.."), i get that error from the server side when it's trying to reply

This could be due to the fact that the server certificate is not configured properly with HTTP.SYS in the HTTPS case

Can i somehow programatically install certificate for that temp reply endpoint? Maybe somehow create ServiceHost object and use it when i create my InstanceContext?


Solution

  • When we use https protocol address to communicate with each other, we need to set up the certificate with following command.

    netsh http add sslcert ipport=0.0.0.0:8000 certhash=0000000000003ed9cd0c315bbb6dc1c08da5e6 appid={00112233-4455-6677-8899-AABBCCDDEEFF}

    Here are the official details.
    https://learn.microsoft.com/en-us/dotnet/framework/wcf/feature-details/how-to-configure-a-port-with-an-ssl-certificate
    https://learn.microsoft.com/en-us/windows/desktop/http/add-sslcert
    If you host the service with internet information server (IIS), you could complete this with IIS. https://learn.microsoft.com/en-us/dotnet/framework/wcf/feature-details/how-to-configure-an-iis-hosted-wcf-service-with-ssl
    Feel free to let me know if the problem still exists.