How can I get rid of the "The target assembly contains no service types" error message in VS2008?
It's always like that. You search for 2 hours, you eventually end up posting on SO, and 5 minutes later, you find the answer.
In the WCF Options tab of the properties of the project defining the ServiceContract
,
there's a checkbox labelled "Start WCF Service Host when debugging another project in the same solution" that I unchecked.
I've no idea how it has been checked in the first place.
Anyway, that solved my problem. See the MSDN Reference for this project setting.
Just in case anyone else is looking for an answer, another cause of this error can be if you happen to have an App.config
file in a project that is a Class Library that has a <system.serviceModel>
section.
I moved service code out of a project that was an executable to a different project but accidentally left the old App.config
file. My new project, which was a Console application programatically configured and started WCF, but because the old App.config
file was in the referenced assembly, I would get that cryptic dialog box even when debugging the Console application.
Took about 12 hours to track this one down since I didn't realize that VS debugger checks all referenced assemblies for App.config which have WCF services configured.
To determine project with this problem find string 3D9AD99F-2412-4246-B90B-4EAA41C64699 in your project files.
Example: <ProjectTypeGuids>{3D9AD99F-2412-4246-B90B-4EAA41C64699};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
Then turn off project option "WCF Options/Start WCF Service Host when debugging another project in the same solution"