91在线一级黄片|91视频在线观看18|成人夜间呦呦网站|91资源欧美日韩超碰|久久最新免费精品视频一区二区三区|国产探花视频在线观看|黄片真人免费三级片毛片|国产人无码视频在线|精品成人影视无码三区|久久视频爱久久免费精品

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

新聞中心

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

WCF服務(wù)的引用是一個比較簡單的方式。我們可以通過兩種方式來實現(xiàn)引用WCF服務(wù)。在這里,就向大家詳細講解引用WCF服務(wù)的方法。#t#

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

引用WCF服務(wù)1.在項目的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ù),比如第一種方式,如果沒有定義配置文件,則會報 找不到鍵值的錯誤提示.


分享文章:引用WCF服務(wù)經(jīng)驗分享
本文路徑:http://m.jiaoqi3.com/article/cdcjppj.html