使用IIS发布WCF服务的详细步骤

前期准备:

  1. 安装Visual Studio 2005 RTM. 注意,Cider目前不支持VS的Express版本,还要注意先删除以前CTP的安装。
  2. 下载并且安装 Microsoft Pre-Release Software WinFX Runtime Components - December Community Technology Preview (CTP)。下载文件名为winfxsetup.exe (或dotnetfx3.exe)
  3. 下载并且安装Microsoft Windows Software Development Kit (SDK) for the December 2005 Community Technology Preview (CTP)。下载文件名为6.0.5270.0.9.WindowsSDK_Vista_idw.DVD.Rel_Update.img
  4. 下载并且安装Microsoft Visual Studio Code Name “Orcas” Community Technology Preview - WinFX Development Tools。下载文件名为vsextwfx.msi.

 

一、建立WCF服务并对其进行配置:
1、如图新建一个WCFServiceLibrary项目,名字为WCFServiceLibrary1,然后生成WCFServiceLibrary1.dll


2、如图创建一个网站的WCFService服务名字为WCFService1

3、在WCFService项目中引用刚才我们生成的WCFServiceLibrary  DLL文件

4、使用Service Configuration Editor配置Config文件(若没有该文件则需要新建一个)

5、先行配置Service Behavior



6、配置Services


配置完成后的Config文件:

在IIS中运行SVC文件后的效果图:

二、WCF Service的调用
 1、新建一个WIndows应用程序项目
 2、用以下方法引用WCF Service:


3、在button1_Click下写如下代码:

4、最终运行效果如图:

posted on 2008-02-21 08:50  Above The Sky  阅读(463)  评论(0编辑  收藏  举报

导航