Hosting WCF Services in Windows Activation Service {转载}

该文转载自:http://www.devx.com/VistaSpecialReport/Article/33831

 

简单地说,WAS是IIS7的一个新特性,它增强了IIS6只能提供HTTP侦听的情况,而WAS则可以提供其他协议的侦听,例如tcp 和namedpiple等等

====================================================================================

 

3174.gif

 

3595.gif indows Activation Service (WAS), introduced with Windows Vista, is the new process activation mechanism that ships with IIS 7.0. WAS builds on the existing IIS 6.0 process and hosting models, but is much more powerful because it provides support for other protocols besides HTTP, such as TCP and Named Pipes.
By hosting the Windows Communication Foundation (WCF) services in WAS, you can take advantage of WAS features such as process recycling, rapid failover protection, and the common configuration system, all of which were

Setting up WAS
Before getting into the steps involved in setting up WAS, create a new WCF Service project named WASHostedService through Visual Studio 2005. I've used C# for the examples here, but you can easily translate them to VB.NET.

Figure 1. WAS Hosting for Non-HTTP Protocols: To make your WCF services available for remote invocation through TCP, Named Pipe and MSMQ protocol bindings, turn on the WCF Non-HTTP Activation feature through the Windows Features dialog box.

In Windows Vista, you need to perform two steps to host WCF services in WAS. First, install the WCF Non-HTTP activation components. To do that, go to the Start menu —> Control Panel —> Programs and Features, and then click "Turn Windows Components On or Off" in the left pane. Expand the Microsoft .NET Framework 3.0 node and ensure that the "Windows Communication Foundation Non-HTTP Activation" feature is checked as shown in Figure 1.
Second, to use a non-HTTP protocol such as TCP or Named Pipes, you need to add the site binding to the WAS configuration. As an example, here's how you'd bind the default web site to the TCP protocol. Go to the Start menu —> Programs —>Accessories. Right click on the "Command Prompt" item, and select "Run as administrator" from the context menu. You'll see a command prompt that has the requested elevated administrator permissions so you can execute administrator commands. Execute the following command:

   <DriveName>\Windows\system32\inetsrv\appcmd.exe set 
      site "Default Web Site" --
      +bindings.[protocol='net.tcp',bindingInformation='808:*']
That command adds the net.tcp site binding to the default web site by modifying the applicationHost.config file located in the <DriveName>\Windows\system32\inetsrv\config directory.
After binding the default web site to the appropriate protocol, you need to enable the individual web applications to support the same protocol. To enable net.tcp for the WASHostedService site, run the following command from an administrator-level command prompt:
   %windir%\system32\inetsrv\appcmd.exe set app 
      "Default Web Site/MyProjects/DevX/WASHostedService" 
      /enabledProtocols:http,net.tcp
Now that you have set up the web site and application, you are ready to create a service and host it in WAS.

 

如果使用Win 7则,则配置窗口大致如下

image

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值