Click here to Skip to main content
15,888,610 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

Think this one is simple - at least simple to ask: I have a working WCF service exposed on a IIS-7 hosted website and a Silverlight 4 consuming app to call it. Then I have a service method like:

XML
public ObservableCollection<Headline> GetHeadlines()
{...}


Where
Heading
is part of a model-project referenced by both the WS and the SL app.

Now, when I publish this WS and browse it in IE it fails with:

VB
The server was unable to process the request due to an internal error. For more information about the error, either turn on IncludeExceptionDetailInFaults (either from ServiceBehaviorAttribute or from the <serviceDebug> configuration behavior) on the server in order to send the exception information back to the client, or turn on tracing as per the Microsoft .NET Framework 3.0 SDK documentation and inspect the server trace logs.


However if I change the method signature to:

MIDL
public ObservableCollection<string> GetHeadlines()
{...}


it all works fine.

Seems to work for all build-in types like string and List<string> etc. but not for my model classes. I don't understand why. Is it some streaming issue perhaps?

Model class is really simple - no base, on interface - just a placeholder with two members.
Posted

1 solution

You need to make it serializable for WCF, with the DataContract and DataMember attributes. MSDN introduction to data contracts[^] may help you.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900