日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 人文社科 > 生活经验 >内容正文

生活经验

WCF之多个终结点

發布時間:2023/11/27 生活经验 44 豆豆
生活随笔 收集整理的這篇文章主要介紹了 WCF之多个终结点 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

1.服務端配置如下(一個Service節點下可有多個endpoint,):

 1  1<system.serviceModel>
 2 2 <services>
 3 3 <service name="Microsoft.ServiceModel.Samples.CalculatorService" behaviorConfiguration="returnFaults">
 4 4 <endpoint address="http://localhost:8000/GIX4" binding ="customBinding"
 5 5 bindingConfiguration="compactBindingConfig" contract="Microsoft.ServiceModel.Samples.ICalculator"/>
 6 6 <endpoint address="basic" binding="basicHttpBinding" contract="Microsoft.ServiceModel.Samples.ICalculator"></endpoint>
 7 <!--前面加個basic基址就變成了http://localhost:8000/GIX4/basic-->
 8 7 <endpoint address="secure" binding="wsHttpBinding" contract="Microsoft.ServiceModel.Samples.ICalculator"></endpoint> 
 9 8 <host>
10 9 <baseAddresses>
11 10 <add baseAddress="http://localhost:8000/GIX4"/>
12 11 </baseAddresses>
13 12 </host>
14 13 </service> 
15 14 </services>
16 15 </system.serviceModel>

2. 客戶端配置:

 1    <system.serviceModel>
 2         <bindings>
 3             <basicHttpBinding>
 4                 <binding name="BasicHttpBinding_ICalculator" />
 5             </basicHttpBinding>
 6             <customBinding>
 7                 <binding name="CustomBinding_ICalculator">
 8                     <binaryMessageEncoding />
 9                     <httpTransport />
10                 </binding>
11             </customBinding>
12             <wsHttpBinding>
13                 <binding name="WSHttpBinding_ICalculator" />
14             </wsHttpBinding>
15         </bindings>
16         <client>            
17             <endpoint address="http://localhost:8000/GIX4" binding="customBinding"
18                 bindingConfiguration="CustomBinding_ICalculator" contract="Calculator.Service.ICalculator"
19                 name="CustomBinding_ICalculator" />
20             <endpoint address="http://localhost:8000/GIX4/basic" binding="basicHttpBinding"
21                 contract="Calculator.Service.ICalculator"
22                 name="basic" />
23             <endpoint address="http://localhost:8000/GIX4/secure" binding="wsHttpBinding"
24                 contract="Calculator.Service.ICalculator"
25                 name="secure"> <!--加上一個名字-->
26                 <identity>
27                     <userPrincipalName value="chenlh@huawei" />
28                 </identity>
29             </endpoint>
30         </client>
31     </system.serviceModel>

3.客戶端聲明如下:

?1 CalculatorClient client = new CalculatorClient("basic");?

轉載于:https://www.cnblogs.com/lihongchen/p/3607379.html

總結

以上是生活随笔為你收集整理的WCF之多个终结点的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。