首页 文章

将Azure移动服务连接到UWP

提问于
浏览
0

我在Azure中创建了一个Mobile服务,并在其中连接了一个SQL数据库 . 我安装了所需的Nuget Package Microsoft.Azure.Mobile.Client,我尝试了Microsoft.WindowsAzure.MobileServices,并在我的App.xaml.cs中插入了这段代码:

public static MobileServiceClient MobileService = new MobileServiceClient("https://sqlbackend.azurewebsites.net");

The Problem is: 当我将天蓝色移动服务连接到项目时,他们说它不受支持 .

有没有办法将我的项目连接到天蓝色的移动服务?

Connected Services panel

2 回答

  • 0

    客户是什么样的项目?

    如果它本身是 Azure Mobile ServiceAzure Mobile App ,则无需添加连接服务,只需右键单击该项目,选择 Publish ,导入Web应用程序发布设置文件并发布到Azure .

    如果它是 Windows Phone WebView App 或工具手势支持的其他人,则将启用配置按钮, App.xaml.cs 中的代码应为:

    public static MobileServiceClient MobileService = new MobileServiceClient ("https://sqlbackend.azurewebsites.net", "XXXX-APPLICATION-KEY-XXXXX");

    第二个参数是应用程序密钥,它在此处生成:

    enter image description here

    PS: 上面的代码和添加连接服务(Azure移动服务)达到了相同的结果,无需同时使用它们 .

  • 2

    您正在使用旧的Azure移动服务客户端 .

    你的链接:

    当您转换为使用Microsoft.WindowsAzure.MobileServices时,它将注入正确的 Headers ,您将不会收到Unsupported消息 .

    再次检查您的问题后,您需要将服务器中的类型与客户端中的类型进行匹配 . 如果您已创建Azure移动服务,则您的客户端应为Microsoft.Azure.Mobile.Client . 如果您已创建Azure App Service移动应用程序,则您的客户端应为Microsoft.WindowsAzure.Mobile.Client - 我提供的链接适用于Azure移动应用程序(不是客户端中的服务) . 我推荐Azure移动应用程序(可以被认为是最新一代) . 教程可在azure.com上找到

相关问题