Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I get rid of the "The target assembly contains no service types" error message in VS2008?

I've got a Client/Server wcf application

My executable doesn't define any ServiceContract, it doesn't even have a reference to System.ServiceModel (but instead has a reference to an assembly which contains the connection logic to the server)

I've another assembly, which is referenced by my EXE, which contains a ServiceContract.

It used to work fine. Yesterday, I've played a lot with my project settings (partial trust, full trust, deployment settings, and so on) and now, each and every time I launch my client, I've got the following message box :

Microsoft WCF Service Host
The target assembly contains no service types.
You may need to adjust the Code Access Security policy of this assembly.

Then VS freezes for 1 minute, and eventually lets me debug my program as usual.

I've found a post on this problem, but the solution doesn't apply in my situation. Any ideas?

like image 330
Brann Avatar asked Feb 19 '09 09:02

Brann


1 Answers

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.

like image 196
Brann Avatar answered Sep 29 '22 23:09

Brann