WCF 实际应用中遇到的问题,求解?

应用场景描述:

我的WCF架构总体是这个样子的:

WCFHost:这个是WCF服务寄宿 及ServiceHost(控制台程序)

WCFService:这个是契约层(接口)WCFService中有多个ISayService,IWCFService

WCFBLL:这个是业务逻辑层 是实现WCFService接口的项目  多个实现以上接口的类

 

现在的解决方案:

服务端:使用了WCF配置文件App.config的方式来设置WCF服务信息  一下是App.config的详细配置 

ExpandedBlockStart.gif 代码
< system.serviceModel >
    
    
<!--  定义service和Endpiont行为 -->
    
< behaviors >
      
<!--  定义service的行为 -->
      
< serviceBehaviors >
              
< behavior name = " MyServiceBehavior " >           
          
< serviceMetadata httpGetEnabled = " true "  httpGetUrl = " http://192.168.0.28:8081/mex "   />
          
< serviceDebug includeExceptionDetailInFaults = " false "   />
          
< serviceCredentials >
            
< clientCertificate >
              
< authentication certificateValidationMode = " Custom "  customCertificateValidatorType = " WCFHost.CustomX509CertificateValidator,WCFHost " />
            
</ clientCertificate >
            
< serviceCertificate findValue = " YSTXServer "  storeLocation = " CurrentUser "     x509FindType = " FindBySubjectName "   />            
          
</ serviceCredentials >
        
</ behavior >
      
</ serviceBehaviors >
    
</ behaviors >

    
< bindings >
          
< wsHttpBinding >
               
< binding name = " NewBinding0 " >
          
< security mode = " Message " >
            
< message clientCredentialType = " Certificate " />
          
</ security >
        
</ binding >
      
</ wsHttpBinding >
    
</ bindings >

     
    
< services >

<!-- Service1 -->

      
< service behaviorConfiguration = " MyServiceBehavior "  name = " BLL.MyService " >
               
< endpoint address = " MyService "  binding = " wsHttpBinding "  contract = " WCFService.IMyService "  bindingConfiguration = " NewBinding0 " />
        
< host >
          
< baseAddresses >
             
< add baseAddress = " http://192.168.0.28:8081 " />
          
</ baseAddresses >
        
</ host >
      
</ service >

<!-- Service2 -->
      
< service behaviorConfiguration = " MyServiceBehavior "  name = " BLL.ServiceSay " >
        
< endpoint address = " SayService "  binding = " wsHttpBinding "  contract = " WCFService.IService "  bindingConfiguration = " NewBinding0 " ></ endpoint >       
      
</ service >
    
</ services >
  
</ system.serviceModel >

 

 

问题:

如何在一个ServiceHost中把这个两个WCF服务发布,通过配置的方式/通过完全编码的方式?

希望WCF牛人,能够解惑!!

 备注:一个Service下用多个 endpoint是不可以的,因为一个Service下的多个EndPoint 只是这个Service的多个调用方式和契约。不能实现多个Service的发布。

 

 

转载于:https://www.cnblogs.com/whyxup/archive/2010/02/10/1667133.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值