Can several WCF services share a common BaseAddress?

前端 未结 3 1189
感动是毒
感动是毒 2020-12-28 09:38

I\'ve got an assembly containing several WCF services, each with its own contract. It all works nicely. The service config in the app.config for the service looks like this:

3条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-28 09:53

    You can combine all contracts in one class, so you have one service with a baseaddress and one (or more) endpoint(s) per contract.

    To avoid having one large class-file you can use the partial-keyword (asuming you use c#) to split the class across multiple files. Each file can implement one contract, that makes maintaining the individual interfaces much easier.

    In C++ you can use #includes or multiple inheritance, but that imply a large amount of discipline...

    Your config would look like this:

    
      
        
          
            
          
        
        
          
            
          
        
        
          
            
          
        
        
        
          
            
          
        
      
    
    

提交回复
热议问题