I have a WCF service called ExceptionsJSONService. Unlike all the other services defined in my solution it can't be instantiated client side in javascript for some reason.
This fails:
var service = new ExceptionsJSONService();
with Object Expected. I've been trying to figure out why this happens and checked all my definitions throughout the project and everything looks fine and is in line with all the other services I've defined (which all work).
Then I checked the svclog file and found an error. The exception type is:
System.Runtime.Serialization.InvalidDataContractException, System.Runtime.Serialization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
The exception message is:
Type 'System.Data.Entity.DbSet`1[CCMModel.AttachmentDoc]' cannot be serialized. Consider marking it with the DataContractAttribute attribute, and marking all of its members you want serialized with the DataMemberAttribute attribute. If the type is a collection, consider marking it with the CollectionDataContractAttribute. See the Microsoft .NET Framework documentation for other supported types.
CCMModel is the namespace and AttachmentDoc is one of my entities. The issue isn't with AttachmentDoc though. It's just going through the list of entities alphabetically. I renamed an entity from Attachments to RAttachments and it just moved on to throwing an exception with AttachmentDoc.
The thing is, nowhere in my code do I try to serialize any EF entities. All the classes that I serialize have DataContracts. The reason I believe the two are related is the exception occurs right after Open ServiceHost 'ExceptionsJSONService' appears in the svclog.
Anybody encounter this before?