日韩无码专区无码一级三级片|91人人爱网站中日韩无码电影|厨房大战丰满熟妇|AV高清无码在线免费观看|另类AV日韩少妇熟女|中文日本大黄一级黄色片|色情在线视频免费|亚洲成人特黄a片|黄片wwwav色图欧美|欧亚乱色一区二区三区

RELATEED CONSULTING
相關(guān)咨詢
選擇下列產(chǎn)品馬上在線溝通
服務(wù)時(shí)間:8:30-17:00
你可能遇到了下面的問(wèn)題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營(yíng)銷(xiāo)解決方案
引用WCF服務(wù)經(jīng)驗(yàn)分享

WCF服務(wù)的引用是一個(gè)比較簡(jiǎn)單的方式。我們可以通過(guò)兩種方式來(lái)實(shí)現(xiàn)引用WCF服務(wù)。在這里,就向大家詳細(xì)講解引用WCF服務(wù)的方法。#t#

我們提供的服務(wù)有:成都網(wǎng)站設(shè)計(jì)、成都網(wǎng)站建設(shè)、外貿(mào)網(wǎng)站建設(shè)、微信公眾號(hào)開(kāi)發(fā)、網(wǎng)站優(yōu)化、網(wǎng)站認(rèn)證、江寧ssl等。為近1000家企事業(yè)單位解決了網(wǎng)站和推廣的問(wèn)題。提供周到的售前咨詢和貼心的售后服務(wù),是有科學(xué)管理、有技術(shù)的江寧網(wǎng)站制作公司

引用WCF服務(wù)1.在項(xiàng)目的ServiceReferences.ClientConfig文件中加入WCF服務(wù)定義,如下:

  1. view plaincopy to clipboardprint?  
  2. < configuration>   
  3. < system.serviceModel>   
  4. < bindings>   
  5. < basicHttpBinding>   
  6. < binding name="BasicHttpBinding_IService"
     maxBufferSize="2147483647"   
  7. maxReceivedMessageSize="2147483647">   
  8. < security mode="None" />   
  9. < /binding>   
  10. < /basicHttpBinding>   
  11. < /bindings>   
  12. < client>   
  13. < endpoint address="http://localhost:2442
    /Service1.svc" binding="basicHttpBinding"   
  14. bindingConfiguration="BasicHttpBinding_IService" 
    contract="ServiceReference1.IService1"   
  15. name="BasicHttpBinding_IService" />   
  16. < /client>   
  17. < /system.serviceModel>   
  18. < /configuration>   
  19. < configuration> 
  20. < system.serviceModel> 
  21. < bindings> 
  22. < basicHttpBinding> 
  23. < binding name="BasicHttpBinding_IService"
     maxBufferSize="2147483647" 
  24. maxReceivedMessageSize="2147483647"> 
  25. < security mode="None" /> 
  26. < /binding> 
  27. < /basicHttpBinding> 
  28. < /bindings> 
  29. < client> 
  30. < endpoint address="http://localhost:2442/
    Service1.svc" binding="basicHttpBinding" 
  31. bindingConfiguration="BasicHttpBinding_
    IService" contract="ServiceReference1.IService1" 
  32. name="BasicHttpBinding_IService" /> 
  33. < /client> 
  34. < /system.serviceModel> 
  35. < /configuration> 

在CS文件中,使用如下代碼引用WCF服務(wù)

 
 
 
  1. view plaincopy to clipboardprint?  
  2. var client = new 
    ServiceReference1.Service1Client();   
  3. var client = new 
    ServiceReference1.Service1Client(); 

引用WCF服務(wù)2:在CS文件中,直接定義WCF服務(wù),代碼如下:

 
 
 
  1. view plaincopy to clipboardprint?  
  2. Binding binding = 
    new BasicHttpBinding();   
  3. EndpointAddress endPoint = 
    new EndpointAddress(   
  4. "http://localhost:2442/Service1.svc");   
  5. Service1Client client =
     new Service1Client(binding, endPoint);   
  6. Binding binding = 
    new BasicHttpBinding();  
  7. EndpointAddress endPoint = 
    new EndpointAddress(  
  8. "http://localhost:2442/Service1.svc");  
  9. Service1Client client = 
    new Service1Client(binding, endPoint);  

以上兩種引用WCF服務(wù)方式都能設(shè)用WCF服務(wù),比如第一種方式,如果沒(méi)有定義配置文件,則會(huì)報(bào) 找不到鍵值的錯(cuò)誤提示.


標(biāo)題名稱:引用WCF服務(wù)經(jīng)驗(yàn)分享
本文路徑:http://www.5511xx.com/article/cdcjppj.html