WCF webservice error with DBML objects

by Pieter Brinkman 7. May 2009 05:34

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 ----> 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.


Hope it helps.

Tags: , , , ,

ASP.Net | Linq | Silverlight

Comments

6/4/2009 12:54:28 AM #

Web Design Company

Thanks for sharing the solution to this issue.

Web Design Company

7/2/2009 1:59:16 AM #

SEO

When a new service reference is added to a Silverlight 3 project, a ServiceReferences.ClientConfig file is automatically created. However, it seems to set the default contract attribute on the endpoint element to the wrong value.

SEO United States

7/20/2009 6:21:35 AM #

Web design


Thanks for that! Just what I was looking for.

Web design United Kingdom

8/11/2009 1:32:52 PM #

Webkidd

Yes!!!!! very useful and exactly what i needed
Thankksss.

Webkidd United States

Powered by BlogEngine.NET 1.5.0.7
Theme by Mads Kristensen

About Me

My name is Pieter Brinkman I am Solution Architect for Sitecore in The Netherlands. My interests are mainly ASP.NET, MSSQL and Content Management Systems.

Calendar

<<  February 2012  >>
MoTuWeThFrSaSu
303112345
6789101112
13141516171819
20212223242526
2728291234
567891011

View posts in large calendar

RecentComments

Comment RSS

Most comments