WAS hosting in WCF

hosting WCF service in IIS 7 and enabling Windows Activation Service to support non-http protocols like TCP.
By default IIS supports only HTTP protocol. If you want to use NON-HTTP protocols like TCP, we need to install "Windows Communication Foundation Non-HTTP Activation" component and WAS (Windows Process Activation Service) component.
WAS is supported on the following platforms with IIS 7 and above.
1. Windows Vista
2. Windows 7
3. Windows Server 2008

To find out which version of IIS you have,

1. Open IIS
2. Click on "Help" menu item
3. Select "About Internet Information Services"

To support NON-HTTP protocols in IIS, we need to do the following

1. Install WAS (Windows Process Activation Service) and "Windows Communication Foundation Non-HTTP Activation component"
2. Enable NON-HTTP protocol support in IIS for your application

Installing WAS (Windows Process Activation Service) and "Windows Communication Foundation Non-HTTP Activation" component

1. Go to control panel
2. Click "Programs and Features"
3. Click on "Turn Windows fetures on or off option"
4. In "Windows Features" window, expand "Microsoft .NET Framework 3.5.1" and select "Windows Communication Foundation Non-HTTP Activation"
5. Click OK


Enable NON-HTTP protocol support in IIS for your application

1. Open IIS
2. Expand "Default Web Site" folder
3. Right click on your application - Manage Application - Advanced Settings
4. In "Advanced Settings" window, set Enabled Protocols = http, net.tcp
5. Finally click OK


At this point we should be able to use both HTTP and TCP protocols

If you get an error stating - Could not load type 'System.ServiceModel.Activation.HttpModule' from assembly 'System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.

Run Visual Studio Command Prompt as an administrator and execute the following command

aspnet_regiis.exe -iru


If you get an error stating - {System.ServiceModel.EndpointNotFoundException: The message could not be dispatched because the service at the endpoint address 'net.tcp://Srinath-pc/WelcomeService/WelcomeService.svc/WelcomeService' is unavailable for the protocol of the address.

Run Visual Studio Command Prompt as an administrator and execute the following command

C:\Windows\Microsoft.NET\Framework64\v4.0.30319> ServiceModelReg.exe -r

These days most of the companies host their wcf services in IIS with WAS (Windows Process Activation Service) enabled as it has the following benefits

1. No code required to host the service

2. IIS provides process recycling, automatic message based activation, idle time management etc

3. Supports all transport protocols including the NON-HTTP protocols like TCP, named pipes etc

No comments:

Post a Comment