Windows Service hosted WCF over HTTPS

后端 未结 3 920
梦如初夏
梦如初夏 2020-12-14 18:22

I\'ve created and configured an SSL certificate as per these instructions from MSDN. I\'m getting the error message that this question lists, but am not sure how to map the

3条回答
  •  感动是毒
    2020-12-14 18:54

    I think you are connecting two different settings. Netsh can be used to add certificate for SSL but also to allow application listening on given port without running under admin account. The exception targets second setting. I haven't seen it before but I assume that you have already registered this port for HTTP so lets try to use (and register) HTTPS on another port or replace previous registration.

    Edit:

    Open command prompt with elevated privileges (As Admin). First check if SSL cert is assigned to correct port:

    netsh http show sslcert
    

    Than check if HTTP listening is registered on that port by calling:

    netsh http show urlacl 
    

    If so use following command to remove that registration:

    netsh http delete urlacl url=http://+:54321/MyService
    

    Add registration again to support listening on HTTPS:

    netsh http add urlacl url=https://+:54321/MyService user=domain\userName
    

    Where user is account used to run your Windows service. If it ia a local account use only userName.

    Note: Under https, it appears the wildcard must be used in the urlacl. We cannot write https://localhost:8733/... to match Visual Studios default urlacl for http. This probably makes sense since the requested hostname isn't available until after decryption.

提交回复
热议问题