5

I am fairly new to hosting web applications and web services. Though I was successful in hosting a web application, I am running into road block after road block when trying to host a WCF service with net.tcp binding.

My scenario is as follows, I have a hosted web application that needs to communicate with a hosted WCF service with net.tcp binding through IIS 7.5. As stated the web application is hosted fine and I can browse the web site. However, the web application makes services calls to the WCF service and I am getting the 'TCP error code 10061' message which I believe is due to my hosted WCF service not running. I think this is not running because I attempt to 'telnet localhost 808' to see if the WCF service is running and it is not. I've run through numerous online guides and I still have had no luck. I believe I may be doing something fundamentally wrong with me being a noob and all. I am able to host the service through VS2010 and run the web application and it works fine so I believe my bindings are correct. I've also enabled tcp protocols on both websites in IIS Manager.

So I guess my real question is what are the IIS Manager steps needed to host a WCF service with net.tcp binding? It appears to me that it is not possible to host a net.tcp service through IIS Manager by simply creating a website because IIS Manager wants to bind to an http port.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
David
  • 51
  • 1
  • 2
  • Did you ever figure this out? I created my own version of your question, but seems I might be running into the same problem as you. http://stackoverflow.com/questions/16628382/setting-up-wcf-tcp-service-in-a-web-application – Niels Brinch May 24 '13 at 21:53

2 Answers2

4

Here are some things to check:

  • Ensure the Net.Tcp Listener Adapter windows service is running
  • Ensure netTcp is listed as an enabled protocol for your website (In IIS Manager, go to Advanced settings for your site)
  • Ensure netTcp is listed as an enabled protocol for application (directory) that is hosting your services (In IIS Manager, go to the directory hosting your services and select Advanced Settings)
  • Ensure your IIS site has a binding for net.tcp, with the correct port number listed.

EDIT:
See the following MSDN page for enabling/using non-HTTP bindings in .Net 4 + IIS 7/7.5:

Configuring the Windows Process Activation Service for Use with Windows Communication Foundation

chris.house.00
  • 3,273
  • 1
  • 27
  • 36
  • 2
    Also, turn on in Windows Features (installing Windows components), under Microsoft.NET Framework 3.5.1 - Windows Communication Foundation Non-HTTP Activation – Bahri Gungor Aug 24 '11 at 19:55
  • Thanks for the quick response. Net.TcpListenerAdapter service is running. netTCP is also and enbabled protocol on both web app and web service. 808:* is a netTCP protocol. WCF non-Http Activation is also installed. I also added my WCF Service to the Default Website and where netTCP port 808 is binded. Another question, how does the my WCF service get bound to port 808? Would it be through my web.config file? Also how does the WCF service get started? IIS Manager status only shows 'Unknown' for the netTCP binding under Default Web Site. Thanks again. – David Aug 24 '11 at 20:40
  • Also, one forum I did come across that I have not done was. I installed .Net 4 prior to adding .Net Framework 3.5.1 Features. A forum said to uninstall .Net 4 before adding .Net Framework 3.5.1 Features. I think I'm going to try this solution next. – David Aug 24 '11 at 21:05
  • Yes, in your web.config, you'll either have a element which would allow you to set the base uri of your service, including the port number, or, if you don't specify this, it will use the default port, which is 808. The service will be started when a request is received by the service endpoint. As far as I know, any non-HTTP protocol bound to a site will always shown a status of "Uknown" – chris.house.00 Aug 24 '11 at 21:09
  • You may also want to take a look at this page from MSDN: http://msdn.microsoft.com/en-us/library/ms752218.aspx This gives a pretty good example of creating a service and client, along with their respective config files and hosting it all in IIS – chris.house.00 Aug 24 '11 at 21:24
  • baseAddresses are as follows which I am assuming is used when I want to host manually such as a console ServiceHost. I also have defined which I also assume sets the port when hosting in IIS – David Aug 24 '11 at 21:26
  • The config you're showing here indicates you're using port 8001 but based on your earlier post, I thought your IIS binding was using port 808? These two numbers will need to match. – chris.house.00 Aug 24 '11 at 21:30
  • I was under the impression was only utilized when self hosting such as using a ServiceHost.exe. I may be wrong, I'll change this base address to be 808 as well. – David Aug 24 '11 at 21:36
  • That didn't work. I'm currently looking at the link you posted. – David Aug 24 '11 at 21:45
  • Update: I ended up throwing in the towel with netTCP binding and went with wsHttpBinding. My requirement was to provide a binding with security so wsHttpBinding did the trick. I really think I missed a step or some how hosed my server during the setup process. I'd like to come back to this issue and at some point I'll re-install Server 2008 and give it another shot and provide another update. I appreciate your help chris.house.00 – David Aug 26 '11 at 16:56
1

And I discovered that for me it didn't work to use localhost... You should use 127.0.0.1 or the name of your computer.