views:

1741

answers:

5

Hi there, I have my WCF service defined as follows [ServiceContract] public interface IService1 { [OperationContract] IList GetMyTable();

    [OperationContract]
    void SendMyTable(List<RatePositions> ratePositions);

    [OperationContract]
    void SendString(string value);
}

When I call GetMyTable() from my SilverLight app it works fine, it brings a List of ratePositions into my app. SendString() also works fine which sends a string from my app.

SendMyTable(List ratePositions) does not work which should sent a List of ratePositions from my app.

The error I get is: The remote server returned an unexpected response: (404) Not Found

Any ideas why this method does not work but the others do?

A: 

Because Silverlight doesn't like "List", but rather it will convert that (on the client) to "ObservableCollection". Try using ObservableCollection instead of List. That should solve your problem.

Timothy Khouri
A: 

hmmm so even though I can pass in a List, set it to the datasource of a DataGrid, play with it inside my silverLight app as a List etc.. I can't send a List out of my app?

Why would that be?

Silverlight is perfectly OK with Lists... just when combined with WCF, it uses "ObservableCollection". Test it, if it works, *then* you can ask why :)
Timothy Khouri
+2  A: 

The problem may be the message size problem with WCF. Look at both the clientconfig file that is created in your silverlight project as well as the web.config in your server project to make sure the size of the data you're returning is not too large.

The 404 error is a catch all for any WCF failure. Can you debug the server code to see if its getting that far?

Shawn Wildermuth
A: 

I fixed this probelm by increasing the MaxBufferSize in the config file.

Crap error message!

A: 

Anyone else is facing this issue? I increased the MaxBufferSize in the ServiceReferences.ClientConfig to 999999999 but still I am getting the same error.

Harish