Yesterday I was transitioning our wcf services previously hosted in a windows service and exposed via net.tcp binding to the brand new shiny windows 2008 r2 server and IIS 7. The plan was to host the service in IIS but still use net.tcp binding so the performance would hopefully be the same as in windows service, but a hell lot easier to deploy and maintain and scale.
But boy! Aren't wcf error messages cryptic? Look for instance the following error when I try to access the service from an asp.net website client.
(Click to enlarge)
My heads were spinning as to why the protocol is being denied. I immediately went through checking the basics
- Is net.tcp enabled for the hosting website? It was!
- Have I given a proper net.tcp binding port for the hosting website? Yes I did. It was port 1002
- Am I calling the correct binding and port from my client? Yes I did.
In a different instance where I installed VS 2010 and .Net 4.0 first and then enabled ".NET 3.5" in add/remove programs, the same issue showed up with the exact error message. The solution to that is
1. Open a command prompt
2. Navigate to c:\windows\microsoft.net\framework64\v4.0.30319
3. Register the service model using the command "ServiceModelReg.exe -r"