Search code examples
wcfiis-7net.tcp

WCF net.tcp port sharing on IIS 7 / WAS


I am new to wcf programming and I have been working on a small project and am having problems with net.tcp port sharing. I am using .net framework 4 and iis 7.

I have two wcf services (serviceA and serviceB) being hosted on our server in separate websites on IIS. Each website has its own .svc file, web.config and bin. If I have each of these services on different net.tcp ports then there is no problem and I can add the service reference to each of them from visual studio on my pc. The services run fine.

However we will soon be starting a project with many more services and we wish to avoid having to open a tcp port for each one so I have been trying to get serviceA and serviceB to port share. If I set them up on the same port then I can access the first service I add but when when I try to access the second service added to the same port i get the following error:

Metadata contains a reference that cannot be resolved: 'net.tcp://myserver/serviceB.svc'. The socket connection was aborted. This could be caused by an error processing your message or a receive timeout being exceeded by the remote host, or an underlying network resource issue. Local socket timeout was **. An existing connection was forcibly closed by the remote host If the service is defined in the current solution, try building the solution and adding the service reference again.

I can not work out what is going wrong. I have done a lot of searching on the subject and I have made sure that the following services are running:

Windows Process Activation Service Net.Tcp Port Sharing Service Net.Tcp Listener Adaptor

In addition net.tcp is an enabled protocol in the website's advanced settings. My current best guess is that it might have something to do with how I have defined the net.tcp bindings in IIS manager. Both of my websites running their independant services have the following: 808:*(net.tcp) is this correct?

As i said earlier the tcp services run fine if set up on two separate ports so the issue must be related to the port sharing. Very grateful for any advice


Solution

  • OK I found the problem I was having. In IIS I had set up each service as its own website and was trying to get those different websites to port share. This would not work.

    However I found that if I set up just one website and then added my services as seaprate applications under the website then the port sharing will work. This approach lets me have multiple services as applications under one website.