How to configure a single WCF Service to have multiple HTTP and HTTPS endpoints?

前端 未结 5 943
不思量自难忘°
不思量自难忘° 2020-12-28 10:08

What I am trying to do is get a SINGLE WCF Service to work in the development environment which is the HTTP scheme, and, also, have the SAME service work in the production e

5条回答
  •  自闭症患者
    2020-12-28 10:41

    If you're using Visual Studio 2010 and Web Application Project Deployment you can use the Web.config Transformation Syntax to point your service endpoint's bindingConfiguration to an https enabled binding configuration.

    For me, I figured out I only had to replace two elements in the Web.config file. The endpoint's bindingConfiguration attribute and serviceMetadata's httpsGetEnabled should be set to true.

    Here's the Web.config, in its default (debug) configuration:

    
        
        
        ...
        
        
            
                
                
            
        
    
    

    Here's the Web.Release.config transformation file

    
        
            
                
                
            
        
    
    
        
            
        
    
    

    Here's what my bindings look like, but they are pretty standard. notice the names that are used above:

    
        
            
            
        
        
            
            
        
    
    

    Here's a link to more about Web.config transformations:

    http://msdn.microsoft.com/en-us/library/dd465326(VS.100).aspx

提交回复
热议问题