How to Configure WAS to Host a WCF Service?

To host your WCF service by using WAS, select Windows Communication Foundation Non-Http Activation Components on the host computer by using the Turn Windows features on or off function. You must also bind the desired Web site to a non-HTTP port to support the non-HTTP-based activation. The following code example shows you how to bind the default Web site to a non-HTTP port by using the appcmd command-line tool, which is installed with IIS 7.0.

[appcmd example]

appcmd set site "Default Web Site"-+bindings.[protocol='net.tcp',bindingInformation='9000:*']

You can also bind a specific Web application to a non-HTTP port, as the following code example shows.

appcmd set app "Default Web Site/BankService"/enabledProtocols:http,net.tcp,net.pipe

If you run the appcmd tool, it modifies the IIS 7.0 configuration setting in the applicationHost.config file in the C:\\Windows\\System32\\inetsrv\\config folder. When you have enabled a non-HTTP protocol such as TCP, if you want to define an endpoint that uses the protocol, you must substitute http for net.tcp in the endpoint address, as the following code example shows.

[Example tcp endpoint address]

address="net.tcp://localhost/BankService/BankServiceIISHost.svc"

For more information about configuring the WCF activation components, see How to: Install and Configure WCF Activation Components