C# Xamarin表单PCL项目出现Azure移动服务错误

C# Xamarin表单PCL项目出现Azure移动服务错误,c#,azure,xamarin,azure-mobile-services,xamarin-forms,C#,Azure,Xamarin,Azure Mobile Services,Xamarin Forms,我试图在Xamarin Forms PCL项目中使用Azure移动服务,但遇到了无法解决的错误 我在这一点上遵循了Azure的官方文档 ****理由**** 我已经从NuGet软件包安装了Windows Azure移动服务,并将CurrentPlatform.Init;&使用Microsoft.WindowsAzure.MobileServices;在每个平台上。 下面是我发现的一些教程,可以在Xamarin表单中实现Azure移动服务。我试过了,但还是不起作用。这是链接--> 1, 2,

我试图在Xamarin Forms PCL项目中使用Azure移动服务,但遇到了无法解决的错误

我在这一点上遵循了Azure的官方文档

****理由****

我已经从NuGet软件包安装了Windows Azure移动服务,并将CurrentPlatform.Init;&使用Microsoft.WindowsAzure.MobileServices;在每个平台上。 下面是我发现的一些教程,可以在Xamarin表单中实现Azure移动服务。我试过了,但还是不起作用。这是链接--> 1, 2, 3 以下是我的项目代码:

模型

页面

视图模型

下面是显示的错误消息

Java.Lang.RuntimeException: java.lang.reflect.InvocationTargetException
  at --- End of managed exception stack trace ---
  at java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
  at at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
  at Caused by: java.lang.reflect.InvocationTargetException
  at at java.lang.reflect.Method.invoke(Native Method)
  at at java.lang.reflect.Method.invoke(Method.java:372)
  at at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
  at ... 1 more
  at Caused by: md52ce486a14f4bcd95899665e9d932190b.JavaProxyThrowable: Microsoft.WindowsAzure.MobileServices.MobileServiceInvalidOperationException: Error: Table 'Restaurant' does not exist.
  at at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () <IL 0x00011, 0x0004b>
  at at System.Runtime.CompilerServices.AsyncMethodBuilderCore.<ThrowAsync>m__0 (object) <IL 0x00006, 0x0003b>
  at Android.App.SyncContext/<Post>c__AnonStorey0.<>m__0 () [0x00000] in /Users/builder/data/lanes/1780/3518c4ce/source/monodroid/src/Mono.Android/src/Android.App/SyncContext.cs:18
  at Java.Lang.Thread/RunnableImplementor.Run () [0x0000b] in /Users/builder/data/lanes/1780/3518c4ce/source/monodroid/src/Mono.Android/src/Java.Lang/Thread.cs:36
  at Java.Lang.IRunnableInvoker.n_Run (intptr,intptr) [0x00009] in /Users/builder/data/lanes/1780/3518c4ce/source/monodroid/src/Mono.Android/platforms/android-21/src/generated/Java.Lang.IRunnable.cs:71
  at at (wrapper dynamic-method) object.061cf032-901c-4d7a-8b86-094723bf4132 (intptr,intptr) <IL 0x00011, 0x00027>
  at at mono.java.lang.RunnableImplementor.n_run(Native Method)
  at at mono.java.lang.RunnableImplementor.run(RunnableImplementor.java:29)
  at at android.os.Handler.handleCallback(Handler.java:739)
  at at android.os.Handler.dispatchMessage(Handler.java:95)
  at at android.os.Looper.loop(Looper.java:135)
  at at android.app.ActivityThread.main(ActivityThread.java:5254)
  at ... 4 more

错误消息非常明确-表'restaurant'不存在-您确定它存在于您的数据中吗?我也有同样的问题,我必须在Azure UI中手动创建表,因为它不会动态创建它。
using eRestaurant.Model;
using eRestaurant.ViewModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection.Emit;
using System.Text;
using Xamarin.Forms;

namespace eRestaurant
{
    public class RestaurantPage : ContentPage
    {
        RestaurantViewModel viewModel = new RestaurantViewModel();
        ListView RestaurantListView = new ListView();

        public RestaurantPage()
        {
            Title = "Restaurants";
            Style = AppStyle.PageStyle;
            RestaurantListView.RowHeight = 40;

            RestaurantListView.ItemsSource = viewModel.restaurantData;
            RestaurantListView.ItemTemplate = new DataTemplate(typeof(RestaurantViewCell));
            Content = RestaurantListView;
        }
    }
}
using System;
using System.Collections.Generic;
using System.Diagnostics;
using Microsoft.WindowsAzure.MobileServices; //Azure Mobile Service
using System.Threading.Tasks; //For multithreading
using eRestaurant.Model;

namespace eRestaurant.ViewModel
{
    public class RestaurantViewModel
    {
        private IMobileServiceTable<Restaurant> restaurantTable;

        const string applicationURL = @"https://erestaurant.azure-mobile.net/";
        const string applicationKey = @"MyApplicationKey";

        MobileServiceClient client = new MobileServiceClient( applicationURL, applicationKey);


        public IEnumerable<Restaurant> restaurantData;

        public RestaurantViewModel()
        {
            GetData ();
        }

        public async void GetData(){
            restaurantTable = client.GetTable<Restaurant> ();
            restaurantData = await restaurantTable
            .Where (restaurant => restaurant.RestaurantName != null)
            .ToListAsync ();
        }

    }
}
using System;
using Xamarin.Forms;
using System.Collections.Generic;
using eRestaurant.Model;

namespace eRestaurant
{
    public class RestaurantViewCell : ViewCell
    {
        public RestaurantViewCell()
        {    
            Label restaurantName = new Label();
            restaurantName.Style = AppStyle.RestaurantLabelStyle;

            Label tag = new Label();
            tag.Style = AppStyle.TagLabelStyle;

            restaurantName.SetBinding(Label.TextProperty, "RestaurantName");
            tag.SetBinding(Label.TextProperty, "Tag");

            StackLayout nameLayout = new StackLayout()
            {
                HorizontalOptions = LayoutOptions.StartAndExpand,
                Orientation = StackOrientation.Vertical,
                Children = { restaurantName, tag }
            };

            View = nameLayout;
        }
    }
}
Java.Lang.RuntimeException: java.lang.reflect.InvocationTargetException
  at --- End of managed exception stack trace ---
  at java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
  at at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
  at Caused by: java.lang.reflect.InvocationTargetException
  at at java.lang.reflect.Method.invoke(Native Method)
  at at java.lang.reflect.Method.invoke(Method.java:372)
  at at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
  at ... 1 more
  at Caused by: md52ce486a14f4bcd95899665e9d932190b.JavaProxyThrowable: Microsoft.WindowsAzure.MobileServices.MobileServiceInvalidOperationException: Error: Table 'Restaurant' does not exist.
  at at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () <IL 0x00011, 0x0004b>
  at at System.Runtime.CompilerServices.AsyncMethodBuilderCore.<ThrowAsync>m__0 (object) <IL 0x00006, 0x0003b>
  at Android.App.SyncContext/<Post>c__AnonStorey0.<>m__0 () [0x00000] in /Users/builder/data/lanes/1780/3518c4ce/source/monodroid/src/Mono.Android/src/Android.App/SyncContext.cs:18
  at Java.Lang.Thread/RunnableImplementor.Run () [0x0000b] in /Users/builder/data/lanes/1780/3518c4ce/source/monodroid/src/Mono.Android/src/Java.Lang/Thread.cs:36
  at Java.Lang.IRunnableInvoker.n_Run (intptr,intptr) [0x00009] in /Users/builder/data/lanes/1780/3518c4ce/source/monodroid/src/Mono.Android/platforms/android-21/src/generated/Java.Lang.IRunnable.cs:71
  at at (wrapper dynamic-method) object.061cf032-901c-4d7a-8b86-094723bf4132 (intptr,intptr) <IL 0x00011, 0x00027>
  at at mono.java.lang.RunnableImplementor.n_run(Native Method)
  at at mono.java.lang.RunnableImplementor.run(RunnableImplementor.java:29)
  at at android.os.Handler.handleCallback(Handler.java:739)
  at at android.os.Handler.dispatchMessage(Handler.java:95)
  at at android.os.Looper.loop(Looper.java:135)
  at at android.app.ActivityThread.main(ActivityThread.java:5254)
  at ... 4 more