----------------------------Binding綁定:
定義:綁定表示通訊信道的配置;
定義了客戶端與服務端之間的協(xié)議;
---傳輸協(xié)議: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;
----多服務:創(chuàng)建多個servicehost實例,配置文件的添加多個service節(jié)點;
---通過代碼實現(xiàn)服務行為的添加
?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中
更多文章、技術交流、商務合作、聯(lián)系博主
微信掃碼或搜索:z360901061

微信掃一掃加我為好友
QQ號聯(lián)系: 360901061
您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。
【本文對您有幫助就好】元
