While developing WCF client/services, I frequently encounter this annoying error whenever I run my client to connect to the service contract for the first time. I term them as "timewasters". This post will partly serve as a reminder to me, and hopefully someone will benefit from it if they came across the same problem.
The story goes like this, you start up your usual Visual Studio 2005 to work on a simple WCF's application (you know the usual service <-> client stuffs). So you created your service and named your interface IContact with a namespace called Contact
public interface IContact
You then go on to create your configuration and service file, opened up your IIS, create a virtual directory and dumped the appropriate files into the virtual directory. You then test the directory from your Internet Explorer.
Everything works beautifully. So now you do the easy part.
Fire up the SDK command prompt and use the "svcutil" command to create the proxy needed for connection to the service. You create a client project, add the auto-generated proxy and output.config file and start to consume the service via the proxy you've just created. After all is done, you do a run and this came staring at you
So what's wrong? It's all spelled out in the error description actually. The resolution is pretty simple, here's something you can take note so that this error message will be gone for good
- Use full names for your proxy, config files and code calls instead of just the interface name. (NamespaceName.InterfaceName instead of just IntefaceName, "svcutil" will only provide you with the InterfaceName)
- Name your config file correctly (web application uses web.config, desktop applications uses app.config)
I guess if someone ran into the same problem again as I do, they might benefit from this post.