We would like to keep the WCF in the configuration file.
At the same time we would like the code to refuse a request if the data will be sent over the net unencrypted. Something like: if the request is basichttpbinding without https, throw exception.
Is there any way for the service code to know how it is being called?
EDIT
From the comments it looks like the question was not that clear.
What I am trying to do is “fix” the following situtaion: We install a service with basichttpBinding and https. Then a administrator changes it to not use https. The effect is that data is sent unencrypted over the net.
Are you self-hosting?? The most simplistic approach would be:
Of course, when you host in IIS, this gets a bit trickier… you might have to create your own custom
ServiceHostdescendant to do this check, and make sure your IIS based *.svc files use that custom host. Of course, a smart admin might be able to trick that by using the baseServiceHostinstead of your own custom host class……