這是來自此處的跟進問題:linq issue with creating relationships關於我收到的答案。林不知道什麼happend,但我得到一個錯誤:底層連接已關閉:接收時發生意外錯誤
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;
}
[Enabled tracing](http://msdn.microsoft.com/en-us/library/ms733025.aspx)?沒有?這樣做,你會看到詳細的錯誤:) – Reniuz 2012-04-27 08:17:05
這是託管在一個控制檯應用程序,所以不認爲這會工作。 – 2012-04-27 08:20:55
如果您通過瀏覽器訪問URL uriGroup,您看到了什麼? – dash 2012-04-27 08:21:41