While working on the team’s Tier Services testbed, that is a collection of WCF services for testing purposes, when I ran into the following issue:
Now foobar.svc would work fine, but foobar2.svc would give me the following error:
The type ‘X’, provided as the Service attribute value in the ServiceHost directive could not be found.
What that translates to is that WCF was trying to load up the type X to host the service but couldn’t find it. The SVC file says that the CodeBehind=”~/App_Code/foobar2.vb”. It should work, right?
Well no, it shouldn’t. I expected it would, but let me explain why not. When you create an IIS application the only /bin or /App_Code folder is in the root directory of the IIS app. So rather than looking for the type X in foobar2.vb in \SubFolder\App_Code\, it was checking \App_Code\.
So having multiple services in the same IIS application node is OK, just remember that you have to put all the code in the root /bin or /App_Code directory.