Franki1986 Franki1986 -4 years ago 140
C# Question

.net webapi self hosted ssl

I would like to create a self hosted webapi that is reachable over https (ssl). I am a little bit confused because I see many different ways to do this. I read something about Karma and owin. As I know Owin is the current way to do this. Ao I implemented the first test with http and everything looks fine. But now I would like to use https. I read that you have to bind a ssl certificate to ip and port. To do this I should call netsh. But I have multiple customer machines where this service has to run. Is there any way to do it automatically in code? I mean why should I have to do it manually?

Answer Source

An SSL cert has to be bound to either a specified host name, or a specified IP address. So if you're installing on several machines, by definition, you'd need multiple SSL certs for your approach to work. You might be able to dump the cert files into a common folder and let your application sort out which one to apply, but you're going to need more than one.

What'd be cool would be if you could call an appropriate API to tell Windows to generate a new cert at run-time!

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download