自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

WCF服務(wù)系統(tǒng)主要組成部分詳解

開發(fā) 開發(fā)工具
WCF服務(wù)系統(tǒng)中主要包括三個部分,分別為:服務(wù)(Service)、主機(Host)和客戶端(Client)。在這里將會做一個詳細介紹。

WCF開發(fā)工具的應(yīng)用,在實際程序開發(fā)中起到了非常大的作用,能為編程人員輕松的創(chuàng)建一個企業(yè)級的安全性極高的互聯(lián)應(yīng)用解決方案。在這里,WCF服務(wù)由IIS托管,且客戶端也是asp.net應(yīng)用。其實,這只不過是WCF服務(wù)系統(tǒng)的一種特殊的實現(xiàn)方式,即Client和Host都是Asp.net。#t#

和其它WCF系統(tǒng)一樣,它包括三個部分:服務(wù)(Service)、主機(Host)和客戶端(Client)。

一、WCF服務(wù)系統(tǒng)之服務(wù)和主機

1、在VS2008中,新建一個Asp.net網(wǎng)站:WCFserver。

 

2、在WCFserver工程中添加新的WCF服務(wù):ServiceWCF,其實也可以直接創(chuàng)建WCF服務(wù)網(wǎng)站。

 

3、 在ServiceWCF中添加一個操作:OnHello()用以返回"Hello World!!”

 

  1. using System;  
  2. using System.Collections.Generic;  
  3. using System.Linq;  
  4. using System.Runtime.Serialization;  
  5. using System.ServiceModel;  
  6. using System.Text;  
  7. public class ServiceWCF : IServiceWCF  
  8. {  
  9. public string OnHello()  
  10. {  
  11. return "Hello World!!";  
  12. }  

4、發(fā)布網(wǎng)站

在IIS中創(chuàng)建相應(yīng)的虛擬目錄,發(fā)布網(wǎng)站,即把WCF服務(wù)交由IIS托管

二、WCF服務(wù)系統(tǒng)之客戶端

1、創(chuàng)建一個Asp.net網(wǎng)站:WEBAJAX,在default.aspx中添加一個Textbox和一個Button控件。

2、在工程WEBAJAX中添加“服務(wù)引用”。

 

3、創(chuàng)建客戶端代理,調(diào)用WCF服務(wù)的操作。

 

 

  1. using System;  
  2. using System.Configuration;  
  3. using System.Data;  
  4. using System.Linq;  
  5. using System.Web;  
  6. using System.Web.Security;  
  7. using System.Web.UI;  
  8. using System.Web.UI.HtmlControls;  
  9. using System.Web.UI.WebControls;  
  10. using System.Web.UI.WebControls.WebParts;  
  11. using System.Xml.Linq;  
  12. public partial class _Default : System.Web.UI.Page   
  13. {  
  14. protected void Page_Load(object sender, EventArgs e)  
  15. {  
  16. }  
  17. protected void Button1_Click(object sender, EventArgs e)  
  18. {  
  19. ServiceReference1.ServiceWCFClient client = 
    new ServiceReference1.ServiceWCFClient();  
  20. string Msg = client.OnHello();  
  21. this.TextBox1.Text = Msg;  
  22. }  

以上就是針對WCF服務(wù)系統(tǒng)做的詳細介紹。

責(zé)任編輯:曹凱 來源: CSDN
相關(guān)推薦

2009-07-07 17:39:26

JSP系統(tǒng)

2009-09-08 09:37:03

LINQ重要組成部分

2009-06-04 07:55:08

Struts框架簡介Struts

2010-03-02 13:23:11

Android手機程序

2009-07-28 15:28:35

ASP.NET AJA

2010-06-29 19:31:48

UML建模技術(shù)

2010-06-30 10:02:05

UML建模技術(shù)

2010-01-22 18:41:32

Visual C++

2023-03-20 15:51:49

綜合布線結(jié)構(gòu)化布線

2016-11-25 09:48:54

Hadoop生態(tài)圈MapReduce

2018-10-25 15:03:13

2021-12-12 08:35:13

數(shù)據(jù)策略數(shù)據(jù)數(shù)據(jù)分析

2023-09-06 10:33:44

2023-07-04 15:54:39

數(shù)據(jù)測試數(shù)據(jù)質(zhì)量開發(fā)

2023-04-03 11:28:11

智能建筑物聯(lián)網(wǎng)

2010-03-02 10:36:05

Android窗體

2022-09-08 08:44:16

數(shù)字化轉(zhuǎn)型技術(shù)

2019-01-07 14:38:22

混合云IaaS微軟

2009-06-15 08:43:46

2023-05-26 09:34:25

SDN網(wǎng)絡(luò)
點贊
收藏

51CTO技術(shù)棧公眾號