Here's a debugging tip for those of you that are developing non-HTTP web services on top of IIS7. IIS7, which comes with Vista and Windows Server 2008, allows you to host activatable services using arbitrary network protocols. WCF ships with protocol handlers for TCP/IP, MSMQ, and named pipes. What do you do though when service activation fails?

First, check the type of error that you're seeing on the client. It should be an EndpointNotFoundException or other similar exception type that tells you that absolutely no application-level processing of the message occurred. If your application can receive messages, then you probably don't have an activation problem. You should obviously make sure that the configuration for the client is correct before proceeding.

Second, check the event and application logs on the server machine to see if they tell you what has gone wrong. You may have to turn on logging if you don't normally run with it enabled. The event log tends to be a particularly useful source of information for activation errors.

Third, if the logs don't give you enough information, then start attempting to manually diagnose the problem. I generally work from the outside in, making sure that the big systems, like IIS, function at all before paying attention to the little systems, like my service. If you have other services that work correctly, then you can usually blow through these stages really quickly until you get down to the service level checks.

Fourth, if manual diagnosis fails, then start attempting to manually debug the problem. I really recommend that you don't get the debugger out until you've exhausted your other options. You might do some casual debugging to catch exceptions during diagnosis but intense debugging sessions are rarely the fastest way to find the problem.

Next time: Data Contract and Message Contract