c# - WCF RESTful - HTTPS for a single operation method -


it possible enable https single operation method in restful wcf? i'm using service mobile application don't want enable https whole service.

sorry english...

not single endpoint. binding of endpoint needs decide whether use http or https (based on transport binding element). if want (and may not need - try profiling "big" responses , without ssl , may find difference not much) can define 2 endpoints, 1 ssl single operation, , 1 without ssl other operations, in example below:

public class stackoverflow_22865228 {     [servicecontract]     public interface isecureoperation     {         [webget]         int add(int x, int y);     }     [servicecontract]     public interface iinsecureoperations     {         [webget]         int subtract(int x, int y);         [webget]         int multiply(int x, int y);     }     public class service : isecureoperation, iinsecureoperations     {         public int add(int x, int y) { return x + y; }         public int subtract(int x, int y) { return x - y; }         public int multiply(int x, int y) { return x * y; }     }     public static void startservice()     {         string baseaddresshttp = "http://localhost:8000/service";         string baseaddresshttps = "https://localhost:8888/service";         servicehost host = new servicehost(typeof(service), new uri(baseaddresshttp), new uri(baseaddresshttps));         host.addserviceendpoint(typeof(isecureoperation), new webhttpbinding(webhttpsecuritymode.transport), "")             .behaviors.add(new webhttpbehavior());         host.addserviceendpoint(typeof(iinsecureoperations), new webhttpbinding(), "")             .behaviors.add(new webhttpbehavior());         host.open();         console.writeline("press enter close");         console.readline();         host.close();     } } 

Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -