WCF in IIS Gotcha: Enable the Right Protocols
Sometimes tough problems have simple (usually overlooked) solutions. If you find that you have WCF code that executes well in the Visual Studio web server only to fail to load in IIS, you may have a protocol problem. I tried running a service that supported multiple protocols only to find this exception when loading to IIS 7:
Could not find a base address that matches scheme net.tcp for the endpoint with binding NetTcpBinding. Registered base address schemes are [http].
You may not think about it much, because most of us are used to running all our IIS stuff using only HTTP. One nice thing about WCF however, is that a single service can support multiple protocols (in this case netTcp and wsHttp). But IIS must have all protocols registered so when my service, which also supports netTcp, tried to execute in IIS it fails to load.
It’s a simple fix. Here’s all you need to do:
- In IIS, right-click your application.
- Select “Manage Application | Advanced Settings…”
- Add “,net.tcp” (leaving off the quotes) to the end of the text in the “Enabled Protocols”
Your application should work after this.