(Sorry, if there is an obvious answer here, I cant find it. Up till now all my services have been HTTPS in Azure hosts, and self-hosted HTTP services for testing. So I’ve not yet learned how to create self-hosted HTTPS services).
I want to provide a service derived from AppSelfHostBase for testing (hosted in console app) that is configured for both
and http://localhost:4455 . https://localhost:4455
How do you do that? (preferably in code or config, command line stuff not preferred)
August 24, 2015, 1:40am
Same as for a normal HttpListener, found a link on StackOverflow:
Just saw you wanted to use multiple prefixes, there’s no API available for that.
Yep, read all those.
Looking for a way to do it in code or config.
August 24, 2015, 1:47am
Doubt it could be done in code other than calling an external process, there’s an
example of using Process.Start in HttpListenerBase
so if I want the SS service to run on both HTTP and HTTPS I would need to call Start() twice right?
Or do I need two instances of MySelfAppHost ??
August 24, 2015, 2:24am
No neither of those are going to work, there can only by 1 AppHost and Start() can’t be called twice.
I’m looking at adding support for it now.
OK, what could I do in the meantime?
Goal is to host both HTTP and HTTPS endpoints for same service in same process.
August 24, 2015, 2:43am
It’s not supported.
You can try subclassing a AppHost then somewhere (e.g. overriding Start()) you can initialize the Listener than add a prefix, e.g:
Listener = new System.Net.HttpListener();
It looks like this may work, but I’d wait for an updated build that supports multiple prefixes.
I think I’ll wait then for a new release. Thanks for the guidance.
August 24, 2015, 3:07am
Latest v4.0.43 on MyGet now has an overload that support an IEnumerable of prefixes.