Hosting WCF Service by Using WAS

 03-Apr-2013   NityaPrakash     WAS  WCF    Comments  0

The Windows Process Activation Service (WAS) extends the functionality of IIS by removing the dependency on the HTTP protocol.  Using WAS, we can host services in IIS that make use of other protocols, like TCP, named pipes and MSMQ.  WAS can listen for requests and activate a service that is waiting on an address that is based on any of these protocols.  Activation of WAS in IIS is possible in IIS7 and later version.  Older versions doesn�t support WAS, hence Service with other protocols than HTTP, can not be hosted on IIS.  We have to configure WAS in IIS before we host the application.  Followings are the steps

Enable WAS

  • Go to Windows Control Panel and then select Install/uninstall programs.
  • Click Turn Windows Features On and Off option in left side pan.

    • Check Windows Process Activation Service

Configure the IIS for WCF Service to Support the TCP Protocol

  • Start the Information Service Manager (IIS) as an administrator

    • In IIS open Edit Binding Window ( IIS �> Connection pane �> Default Web Site �> Right Click �> Edit Bindings).  If WAS is correctly installed than it would appears as following   

      We can see net.tcp protocol in the list which is expecting TCP request on 808.  We can change the port or add multiple port.

    • Close Site Bindings dialog.

    • Expand the Default Web Site item and select the specific service.

    • In the Action pane ( right panel), click on Advance Settings

    • In the Advanced Settings dialog, add net.tcp text separated by comma (,).

    • Click on OK button and save settings.

Now client application can access our service with HTTP protocol as well as TCP protocol.  To verify whether client application really connecting over TCP port, stop the World Wide Web Publishing Service from Service mmc opened from administrative tools.  When we try to connect over HTTP port, connection will fail but TCP connections still works.

Troubleshooting

Sometime, above steps are not enough to get it working.  We can verify following things:

  • Make sure WCF Non-HTTP Activation is enabled in Windows Features

    • Make sure Net.TCP Listener and Net.Tcp Port Sharing Service are both running.

    • If WCF element is not registered with IIS, than run servicemodereg.exe �ia in command prompt.

    • Run aspnet_regiis �I to ensure ASP.NET 4.0 is correctly setup with IIS


Nitya Prakash Sharma has over 10 years of experience in .NET technology. He is currently working as Senior Consultant in industry. He is always keen to learn new things in Technology and eager to apply wherever is possible. He is also has interest in Photography, sketching and painting.

My Blog
Post Comment

COMMENTS