(This post should also be sub-titled: Development Back to Basics)
I was working on a WCF project the other day, trying to resolve some minor behavior anomalies. As I often do, I made some code changes, re-compiled, and de-deployed binaries to IIS6, where this particular WCF service was being hosted.
Having done this numerous times in the past, I was quite surprised to see a ServiceActivationException: "The Service Type could not be found... yadda yadda." Uhhh, what? It's right there!
Scenario: Me, Visual Studio 2005 running on Windows Server 2003. Deployed: Clean, production-quality Windows Server 2003, .net 2.0 & .net 3.0. That's it.
I start digging. Somewhere along the way, I come under the suspicion that dependent assemblies are missing, so I use the most excellent Process Monitor to monitor w3wp.exe for file load failures. (Later, I learn that I think I could have used the Fusion Log Viewer, but Process Monitor worked in this case regardless). I find something interesting:
The w3wp.exe fails to load two dependent assemblies: VJSharpCodeProvider, and CPPCodeProvider.
Question: "Why is my assembly trying to load code providers for J# and C++ when I have clearly written it in C#?"
I racked my brain as to what could have changed in my solution to cause it to be referencing these assemblies. I mean, I checked EVERYTHING, and came up with nada.
After staring at the IDE for literally hours (ok, maybe not continuously), I glanced at the build configuration. The word 'Debug' stared back at me. Could it be?
I recompiled as Release, re-deployed, and voilá! It worked!
As many years as I've been compiling code, you'd think I wouldn't make a silly mistake like this, but it just goes to show you that it's always a good refresher to to get back to basics.