Support us .Net Basics C# SQL ASP.NET ADO.NET MVC Slides C# Programs Subscribe Buy DVD

Part 31 - WAS hosting in WCF

Suggested Videos
Part 28 - Advantages and disadvantages of hosting a wcf service in a windows service
Part 29 - Hosting wcf service in IIS
Part 30 - Advantages and disadvantages of hosting WCF service in IIS



In this video we will discuss, hosting WCF service in IIS 7 and enabling Windows Activation Service to support non-http protocols like TCP. This is continuation to Part 30. Please watch Part 30, before proceeding.



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
Install windows activation service

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
Enable NON-HTTP protocol support in IIS for wcf service

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://venkat-pc/HelloService/HelloService.svc/HelloService' 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

wcf tutorial

1 comment:

  1. I need to make a secure connection between android Xamarin and wcf in pc.
    I found on android Xamarin baisichttp alone. please help me.

    ReplyDelete

If you like this website, please share with your friends on facebook and Google+ and recommend us on google using the g+1 button on the top right hand corner.