1

I have a method like this:

[WebGet(UriTemplate = "/")]
        [OperationContract]
        public XmlElement All() {}

Is there a way to force clients to always use HTTPS? (deny HTTP and allow only HTTPS)?

If yes, how?

Thank you

Will Hartung
  • 115,893
  • 19
  • 128
  • 203

1 Answers1

0

This is IIS configuration.

When you're creating the IIS website to host the WCF service, you would set the bindings on it to only respond on the SSL socket.

Furthering that, you can set up IIS to force redirects from http://www.example.com to https://www.example.com

Here's a tutorial: http://learn.iis.net/page.aspx/144/how-to-set-up-ssl-on-iis/

Stephen Wrighton
  • 36,783
  • 6
  • 67
  • 86
  • Is it possible to have one WCF service that has both HTTP and HTTPS bindings, but certain methods are forced to use HTTPS? – Carlos P May 21 '13 at 12:39
  • @CarlosP Yes, but you would need to have different .svc files for the HTTPS only methods. Then, replace the 403 (or what ever error is returned when using HTTP and SSL is required) error page with a redirect to the HTTPS version of the page. – Trisped Jul 11 '13 at 23:06