WCF netTcpBinding service in WS2008 Beta 2

Yesterday I got the opportunity to start playing with [WCF] net.tcp services hosted in WAS on Windows Server 2008 (Beta 2). There were a couple of hiccups, but it was surprisingly painless.

Firstly, I got the service up and running over wsHttpBinding. One thing I noticed about this is that, unlike XP Pro (and I think Vista), IIS7 on WS2008 doesn't need anonymous set against the svc file for the service endpoint when the rest of the site was running under Windows Authentication. Straight away, this service was working using a remote client over http.

Next up was trying netTcpBinding. First job was getting the required features installed. This MSDN article provides the details as:

To install the WCF non-HTTP Activation Components

  1. From the Start button, click the Control Panel, click Programs, and then click Programs and Features.

  2. From the Tasks menu, click Turn Windows features on or off.

  3. Find the Microsoft.NET Framework 3.0 node, select and expand it.

  4. Select the WCF Non-Http Activation Components box and save the setting.

A few configuration changes were required in the host web.config. Because I wanted to use the same svc endpoint, I had to provide specific addresses in the configuration for each of the bindings because they have different base addresses.

Next I added the net.tcp binding to the site in IIS. This is done through the "Site Bindings" dialog of the site. So what is the format of the "Binding Information" field? I had no idea off the top of my head and unfortunately the help documentation only describes http/https binding configurations. After a quick web search, Nicholas Allen to the rescue:

The format for TCP was picked to be as similar as possible to what already existed for HTTP. We have two parts to configure, again separated by colons. There is no equivalent for the list of addresses. The two parts are

  1. Port number
  2. Host name comparison mode (blank or a wildcard symbol)

I chose a port number and entered 8081:* as my binding information. Now my site bindings look like this:

Running my remote client using the new address and binding didn't work. No connection. Windows Firewall gets me every time. To test if the firewall is the issue, I usually turn off the firewall temporarily and run the client. In this case, the connection was successful. I turned the firewall back on (very important!) and added the TCP port 8081 as an exception in the firewall rules. I also added 8080 as I moved away from the default port 80 for my http binding.

Now I have a connection, but I get an error saying that the protocol net.tcp is not supported. After a quick web search, I found this MSDN article (same as above). It indicates some commands that need to be run. The one that stood out to me is:

%windir%\system32\inetsrv\appcmd.exe set app "Default Web Site/<WCF Application>" /enabledProtocols:http,net.tcp

One of the things I am trying to do is to avoid command executions. So with the hint of "enabledProtocols", I go searching through the IIS admin UI. I stumble across the "Advanced Settings" dialog for the site. I added net.tcp to the enabled protocols.

Job done, service up and running over both http and net.tcp.

blog comments powered by Disqus