这是来自这里的后续问题:关于我收到的答案的创建关系的 linq 问题。我不确定发生了什么,但我收到一个错误:
The underlying connection was closed: An unexpected error occurred on a receive.
这就是异常发生的地方:
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;
}