wcf的binding和host

系统 1980 0

----------------------------Binding绑定:
定义:绑定表示通讯信道的配置;
定义了客户端与服务端之间的协议;
---传输协议:http.tcp.命名管道.msmq,自定义(udp,smtp)
---消息编码:Text.Mtom,Binary,自定义编码;
---标准的绑定:
BasicHttpBinding(兼容soap1.1)\WSHttpBinding(兼容1.2)\NetNamedPipeBinding(进程内或同主机的调用)\NetTcpBinding(同主机或跨主机调用)
\NetPeerTcpBinding(同主机或跨主机调用)\消息绑定: NetMsmqBinding\MsmqIntegrationBinding(用于早期技术的msmsq的交互)
----可以通过配置文件来配置绑定信息;
  <system.serviceModel>
        <client />
  <services>
   <service name="">
    <endpoint binding="netTcpBinding" bindingConfiguration="netTcp" contract="">
     
    </endpoint>
   </service>
  </services>
  <bindings >
   <netTcpBinding>
    <binding name="netTcp" maxReceivedMessageSize="5000000">
     <security mode="Message">
      <message clientCredentialType="Windows"/>
     </security>
    </binding>
   </netTcpBinding>
  </bindings>
    </system.serviceModel>
------------------------------------宿主:
宿主:self-hosting:控制台或windows,windows服务;
IIs/asp.net;
windows activation Service;
----多服务:创建多个servicehost实例,配置文件的添加多个service节点;
---通过代码实现服务行为的添加
 host = new ServiceHost(typeof(wpf));
            ServiceDebugBehavior sb = host.Description.Behaviors.Find<ServiceDebugBehavior>();
            if (sb == null)
            {
                sb = new ServiceDebugBehavior();
                host.Description.Behaviors.Add(sb);
            }
            sb.IncludeExceptionDetailInFaults = true;
            host.Open();
------------IIS/was宿主;
.svc文件在iis中

wcf的binding和host


更多文章、技术交流、商务合作、联系博主

微信扫码或搜索:z360901061

微信扫一扫加我为好友

QQ号联系: 360901061

您的支持是博主写作最大的动力,如果您喜欢我的文章,感觉我的文章对您有帮助,请用微信扫描下面二维码支持博主2元、5元、10元、20元等您想捐的金额吧,狠狠点击下面给点支持吧,站长非常感激您!手机微信长按不能支付解决办法:请将微信支付二维码保存到相册,切换到微信,然后点击微信右上角扫一扫功能,选择支付二维码完成支付。

【本文对您有帮助就好】

您的支持是博主写作最大的动力,如果您喜欢我的文章,感觉我的文章对您有帮助,请用微信扫描上面二维码支持博主2元、5元、10元、自定义金额等您想捐的金额吧,站长会非常 感谢您的哦!!!

发表我的评论
最新评论 总共0条评论