This is a follow up question from here: linq issue with creating relationships in regards to the answer I recieved. Im not sure what has happend but I get an error:
The underlying connection was closed: An unexpected error occurred on a receive.
And this is where the exception happens:
string uriGroup = "http://localhost:8000/Service/Group";
private void ListGroups_Click(object sender, RoutedEventArgs e)
{
XDocument xDoc = XDocument.Load(uriGroup); // this line
var groups = xDoc.Descendants("Group")
.Select(n => new
{
GroupName = n.Element("GroupName").Value,
GroupHeader = n.Element("GroupHeader").Value,
TimeCreated = DateTime.Parse(n.Element("TimeAdded").Value),
Tags = n.Element("Tags").Value,
Messages = n.Element("GroupMessages").Value
})
.ToList();
dataGrid2.ItemsSource = groups;
}
Since you are returning a
List
of objects, it is possible that you have exceeded the MaxItemsInObjectGraph. You can increase the value by modifying your web.config (or app.config):You may also want to consider looking at the usual suspects:
<readerquota>
valuesYou should enable WCF Tracing as it will contain more detailed errors. Yes, this works even for self-hosted apps.