Is there a way in a WCF Rest Service implementation to require one method be called over https, while allowing others to be called over http or https without having to define two service endpoint bindi开发者_开发技巧ngs? I want to be able to do something in my service implementation such as:
if (CalledOverHttps()) {
//Do Stuff
} else {
throw new WebOperationException("Nice try buddy");
}
Thanks in advance!
I handled this with IIS, and requiring https on a virtual directory. So in my directory structure i have:
non secured: http://foo.com/someservice.svc
secured: https://foo.com/secure/someservice.svc
and if you tried http://foo.com/secure/someservice.svc, an appropriate 500 error is thrown by IIS.
I'm not entirely sure, but I believe you can configure it in the bindings.
I have to look it up, though.
精彩评论