標籤

more tags...

最新回覆

[WCF]利用net.tcp傳輸協定來建置WCF Service

最近很少在寫文章,也佷少在討論區解問題(因為工作很忙),所以沒什麼東西可以寫

這幾天無聊去看看WCF的東西,介紹給大家如何利用net.tcp傳輸協定來建置WCF Service


啓動WCF服務的方式有下列幾種方式:

1.利用Console或WinFrom方式
2.利用Windows Service方式
3.利用Web Server IIS方式


WCF支援的傳輸協定有下列幾種方式:

1.HTTP
2.net.tcp
3.net.pipe
4.net.msmq


存取WCF服務的Client端也可利用下列幾種方式:

1.WinForm or Console
2.ASP.NET or ASP.NET AJAX
3.WPF or Silverlight
...很多

首先準備下列專案:

WcfBase是給ConsoleHostWinFormClient共用的
ConsoleHostServer
WinFormClientClient

Server端啓動服務利用ServiceHost
Client端呼叫服務利用ClientBaseChannelFactory

此範例主要是利用Console來啓動WCF Service,利用WinForm來呼叫WCF Service

WcfBase(IHello.cs,Hello.cs)

IHello.cs

Hello.cs

ConsoleHost(Program.cs,App.config)

Program.cs

App.config

WinFormClient(FrmClient.cs,HelloClient.cs,App.config)

FrmClient.cs

HelloClient.cs

App.config


設定Config可以利用SvcConfigEditor.exe工具

參考網址:
http://msdn.microsoft.com/zh-tw/library/bb332338.aspx
http://www.devx.com/codemag/Article/33655/1763/page/1
http://www.codeproject.com/KB/WCF/WCFMultipleHosting.aspx
http://msdn.microsoft.com/zh-tw/library/ms732015.aspx

推到 Twitter!
推到 Plurk!


 

2009/6/21 13:39| 閱讀數 : 3293 | 1 人收藏 我要推薦 | Add Comment | 文章分類 : WCF 訂閱


回覆

目前沒有回應.

發表回覆

標題: *
姓名: *
Email: (將不會被顯示)
Url:
回覆: *
登入後使用進階評論
Please add 2 and 4 and type the answer here:
F6 Team logo


用BloggerAds 替自已加薪

每月文章

文章分類

推薦討論區

推薦部落格