1

I implimenting a server using selfhost webApi. I need to use ssl with certificates that will load a .cer file ( = Used to store a public key ) that will be load from disk when the server will start.

I loaded the the .cer file

X509Certificate2 certificate = new X509Certificate2(fullpath, password);

but i don't know how to set the webapi to use this certificate file.

I don't find any example or how to do it.

Any help please

Thanks

Yanshof
  • 9,659
  • 21
  • 95
  • 195
  • How are you hosting the API. In IIS on your own server, or in Azure etc? – Dylan Morley May 25 '17 at 11:41
  • no, i doing self host. – Yanshof May 25 '17 at 11:43
  • You should not use the code. Go and learn `netsh http` command to see how to set up certificate mapping for HTTPS. That's how certificates are used and your Web API host process should then simply hook to the HTTPS binding. – Lex Li May 25 '17 at 14:13

0 Answers0