Configure System.Net.HttpListener to listen for SSL

Whidbey contains cool class HttpListener under System.Net namespace, it allows you to create your your own HttpServer on top of HttpSys. Some of you aske about steps for configuring HttpListener to work with SSL. Basically you need to configure httpsys. You need to bound particular port to a server certificate, where you want your listener to listen

1) install the server certificate in machine store – you can manually install certificate using mmc (Alternatively you can also use winhttpcertcfg command line tool, which is available with win32 SDK install)

2) next step is to bind the port to use this certificate, this could be done using httpcfg tool (Also a part of win32 sdk), following example demonstrate configuration for port 9443
a. Command line with no client certificate authentication
> httpcfg.exe set ssl -i -c "MY" -h <Certificate Hash>
b. Command line with client certificate authentication
> httpcfg.exe set ssl -i -f 2 -c "MY" -h <Certificate Hash>

To know more about System.Net.HttpListener, check the System.Net Whidbey documentation

To know more about winhttpcertcfg.exe and httpcfg.exe, you could follow the following links,


This posting is provided "AS IS" with no warranties, and confers no rights