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

WCF宿主環(huán)境基本概念詳解

開發(fā) 開發(fā)工具
WCF宿主環(huán)境的相關(guān)內(nèi)容將會(huì)在這篇文章中詳細(xì)介紹。初學(xué)者們可以根據(jù)這里介紹的內(nèi)容對此有一個(gè)充分的掌握。

WCF開發(fā)工具建立于.Net Framework 2.0基礎(chǔ)之上的,它優(yōu)勢非常突出,這些特點(diǎn)決定了它在開發(fā)領(lǐng)域中的地位。在這里我們將會(huì)為大家詳細(xì)介紹一下有關(guān)WCF宿主環(huán)境的相關(guān)概念,希望對大家有所幫助。#t#

WCF 部署模式比較靈活,我們可以依據(jù)服務(wù)的使用目的從多種宿主中選擇一個(gè)最適合的。

可用的WCF宿主環(huán)境模式包括:

"Self-Hosting" in a Managed Application: 也就是 Console Application 或者 WinForm Application。我們在前面的章節(jié)都是使用這種模式進(jìn)行演示。它的好處是簡單、部署方便,但缺乏相關(guān)環(huán)境支持,不適合用于企業(yè)級服務(wù)部署。

Managed Windows Services: 可以隨著操作系統(tǒng)自動(dòng)啟動(dòng),受服務(wù)權(quán)限限制,安全性要比上一種好些。

Internet Information Services (IIS): 和 Web Services 的部署方式類似,由請求消息來激活服務(wù),還可以使用 IIS 提供的 Process recycling、Idle shutdown、Process health monitoring 等功能。缺點(diǎn)是只能使用 Http Binding。

Windows Process Activation Service (WAS): 這個(gè)WCF宿主環(huán)境只有 Windows Vista 和 Microsoft Windows Server(Longhorn) 才提供,它是 IIS7 的一部分。這應(yīng)該是所有WCF宿主環(huán)境中最適合企業(yè)級部署應(yīng)用的。除了 IIS 所提供的那些功能外,最關(guān)鍵的是它支持幾乎所有的通訊協(xié)議。

"Managed Application" 和 "Windows Services" 部署方式非常類似,本文不再詳述。以下介紹一下 IIS 部署的步驟。

1. 安裝完 VS Extension 后,我們可以創(chuàng)建一個(gè) WCF service 的網(wǎng)站項(xiàng)目。

2. 添加一個(gè) WCF service 新項(xiàng),系統(tǒng)自動(dòng)會(huì)創(chuàng)建 Service.svc、App_Code\Service.cs 等必要文件。

3. 在 Service.cs 文件中完成服務(wù)編碼。

4. 添加 web.config 文件,并在其位置單擊鼠標(biāo)右鍵,打開 "Microsoft Service Configuration Editor" 工具完成服務(wù)配置。

5. 注意添加 serviceMetadata,否則我們使用瀏覽器無法查看,也無法創(chuàng)建客戶端代理。

web.config 演示 (注意配置文件中并沒有提供服務(wù)地址)

  1. < ?xml version="1.0"?> 
  2. < configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0"> 
  3. < system.serviceModel> 
  4. < services> 
  5. < service behaviorConfiguration="MyServiceTypeBehaviors" name="MyService"> 
  6. < endpoint binding="wsHttpBinding" contract="IMyService"/> 
  7. < /service> 
  8. < /services> 
  9. < behaviors> 
  10. < serviceBehaviors> 
  11. < behavior name="MyServiceTypeBehaviors"> 
  12. < serviceMetadata httpGetEnabled="true"/> 
  13. < serviceDebug includeExceptionDetailInFaults="true"/> 
  14. < /behavior> 
  15. < /serviceBehaviors> 
  16. < /behaviors> 
  17. < /system.serviceModel> 
  18. < system.web> 
  19. < compilation debug="true"> 
  20. < /system.web> 
  21. < /configuration> 
  22. service.svc   
  23. < %@ ServiceHost Language="C#" Debug="true" Service="MyService" 
    CodeBehind="~/App_Code/service.cs" %> 

以上就是我們?yōu)榇蠹以敿?xì)介紹的WCF宿主環(huán)境相關(guān)內(nèi)容。

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

2010-02-23 16:32:29

WCF服務(wù)

2009-12-21 15:33:07

WCF集合元素

2009-12-21 10:27:52

WCF基本概念

2010-03-02 13:14:38

WCF MSMQ隊(duì)列

2010-03-01 16:25:07

WCF體系架構(gòu)

2010-03-01 14:50:30

WCF行為類型

2010-03-01 18:04:35

WCF配置綁定

2009-12-21 17:05:59

WCF自托管宿主

2010-03-02 11:10:43

WCF標(biāo)準(zhǔn)終結(jié)點(diǎn)

2010-02-25 14:46:31

2010-03-01 16:41:04

WCF數(shù)據(jù)表

2010-03-02 16:22:31

WCF狀態(tài)應(yīng)用

2009-12-21 16:52:02

WCF序列化

2009-12-21 14:37:14

2009-12-22 10:16:54

WCF服務(wù)狀態(tài)

2009-12-29 18:29:09

Silverlight

2010-07-12 09:43:38

Symbian開發(fā)

2010-03-01 17:57:11

WCF緩存機(jī)制

2010-02-02 10:33:22

C++引用

2010-01-12 17:21:29

VB.NET對象
點(diǎn)贊
收藏

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