【发布时间】:2016-07-06 06:17:14
【问题描述】:
我正在使用我开始集成的 Azure 后端制作 Windows 10 应用程序,当我尝试检索数据时遇到最奇怪的错误,请参阅下面的代码:
App.xaml.cs 中的代码
// Setting up a client to retrieve data, using localhost just to try it out
public static MobileServiceClient DigestsTrackerClient = new MobileServiceClient("http://localhost:28451/");
WeekItem.cs 上的代码
// Method to get data from Mobile Services
public static async void GetWeekItems(List<WeekItem> passer)
{
// Getting a InvalidOperationException down here
IMobileServiceTable<WeekItem> weekTable = App.DigestsTrackerClient.GetTable<WeekItem>();
passer = await weekTable.ToListAsync();
}
有关异常的更多信息:
An exception of type 'System.InvalidOperationException' occurred in
Microsoft.WindowsAzure.Mobile.dll but was not handled in user code
Additional information: No 'id' member found on type 'TechDigest.Model.WeekItem'.
另外,这是我要检索的对象的模型:
public class WeekItem
{
public int WeekID { get; set; }
public string Title { get; set; }
public string ImageURI { get; set; }
}
这个错误真的很令人困惑,因为我基本上是从 a demo made by an Azure engineer (18:50) 复制代码而我的抛出了这个奇怪的异常,非常感谢任何帮助。
【问题讨论】:
标签: azure azure-mobile-services