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"
Thanks man.. that helped :)
ReplyDelete"ServiceModelReg.exe -r": This won't work on Server 2012
ReplyDeleteThanks very much,
ReplyDeleteI gave all permissions for the service files and folders to the account under which the app pool for the website is configured to run,
and everything now works.
But it was a tricky problem.
Thanks!!! It works.
ReplyDeleteThanks Dude
ReplyDeleteYou sir are a life saver, i took me a good 5 hours to wrestle with this issue .. but a simple ServiceModelReg.exe -r did it ... Thanks
ReplyDeleteThanks dude. It helps me to consume wcf service locally using net tcp binding.
ReplyDeleteanybody ever found why this happened , i mean why we should we run ServiceModelReg.exe -r command , how to solve this on server ?
ReplyDeleteThanks a lot, this was terribly useful! :D My saviour!
ReplyDeleteWorked for me!
ReplyDelete