How to enable HTTPS on WCF RESTful Service?

后端 未结 3 1252
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-25 15:00

How to make wcf to work over https. I want to use this wcf over https i have searched many articles i didn\'t get the answer please help iam new to wcf concepts. I want to c

3条回答
  •  醉话见心
    2020-12-25 15:30

    It appears you are building a RESTful Service with WCF and you are really close to securing it.

    Here is what you need to do to secure it:

    1. Add a new WebHttpBinding configuration that has security mode set to Transport.
    2. Assign that new WebHttpBinding configuration to the your Service Endpoint binding.
    3. Make sure that your RESTful service can only be accessed via HTTPS by setting httpGetEnabled="false".
    4. Set up the metadata publishing endpoint to use HTTPS.

    These changes are all summed up below in the revised configuration file (see comments for points that changed). Also note that your Service Endpoint must be using the HTTPS scheme and not HTTP.

    
      
         
             
                       bindingConfiguration="webHttpTransportSecurity"
                       behaviorConfiguration="web"
                       contract="WcfRestfulService.IHttpService" />
             
             
         
      
      
      
         
            
               
             
          
      
      
          
             
                 
                                  httpGetEnabled="false"/>
                 
             
          
          
             
                 
             
          
      
      
    
    

提交回复
热议问题