Wednesday, March 4, 2009

WCF "The target assembly contains no service types"

WCF Error

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


 

This is because you have left out your WCF interface.


 

If you have a IWebService.cs and a WebService.cs...  that does WebService: IWebService but for whatever reason you took out the IWebService... like I have done before.. you will get this error.


 

The answer is to put that back in.  You can create interface from your class from class diagram.  Use class diagram almost all the time.  It is very good tool to engineer your code.  It is a must.


 

On the web, there was a suggestion of taking out  {3D9AD99F-2412-4246-B90B-4EAA41C64699};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} from your project file..Don't do it.  I think these are the paired Guid for the WS client and the WS host.  I could be wrong.


 

Good luck.

1 comment:

Rohit R Deo said...

If we skip annotaions in contract class i.e. interfaced then such error may appear.