Pieter Brinkman Blog

WCF webservice error with DBML objects

1 min readpieterASP.NetlinqSilverlight

When deploying a WCF webservice for a Silverligh application I got the following error:

An ExceptionDetail, likely created by IncludeExceptionDetailInFaults=true, whose value is: System.InvalidOperationException: An exception was thrown in a call to a WSDL export extension: System.ServiceModel.Description.DataContractSerializerOperationBehavior  contract: [http://tempuri.org/:IWebService](http://tempuri.org/:IWebService) ----> System.Runtime.Serialization.InvalidDataContractException: Type 'Project.service.HU\_BACH.ScPlacemark' cannot be serialized. Consider marking it with the DataContractAttribute attribute, and marking all of its members you want serialized with the DataMemberAttribute attribute.

As you can see from the error you need to add the [Serializable] attribute to all objects that are used within the webservice. After I did this I got the same error for my Linq to Sql objects generated within my DBML. You can make your Linq to Sql objects serializable by changing the dbml setting Serialization Mode to Unidirectional.  An ExceptionDetail, likely created by IncludeExceptionDetailInFaults=true, whose value is:… Hope it helps.