简体   繁体   English

从不同项目访问Windows Phone上的Azure移动服务

[英]Accessing Azure Mobile Service on Windows Phone from Different Projects

Hello I am having the following exception: 您好,我遇到以下异常:

Additional information: The request could not be completed. 附加信息:请求无法完成。 (Bad Request) (错误的请求)

I did not understand why since the function worked sometimes I therefore found the following on stackoverflow: MobileServiceInvalidOperationException When Trying To Retrieve Data From Azure . 我不明白为什么,由于该功能有时起作用,因此有时会在stackoverflow上找到以下内容: 尝试从Azure检索数据时,出现MobileServiceInvalidOperationException This issue unfortunately does not solve my issue. 不幸的是,这个问题不能解决我的问题。

The time is correct and I am using https connection. 时间是正确的,我正在使用https连接。 And all the communication is working perfectly. 并且所有通信都正常进行。 I however have divided my Windows Phone Silverlight application into several projects, the reason for this I have stated in another stackoverflow question: Deleting project/pages/usercontrols from memory . 但是,我已将Windows Phone Silverlight应用程序划分为几个项目,我在另一个stackoverflow问题中提到的原因是: 从内存中删除项目/页面/用户控件

The application flow is: 申请流程为:

  • Project 1: 项目1:

    1. Login (Authenticate the mobileservice) 登录(验证移动服务)
    2. Navigate to Mainmenu, upon success. 成功后导航至Mainmenu。
    3. Service is contacted await MobileService.InvokeApiAsync<DTO.UserInfoDTO, DTO.UserInfoDTO>(UserInfoDTO); 服务已联系, await MobileService.InvokeApiAsync<DTO.UserInfoDTO, DTO.UserInfoDTO>(UserInfoDTO); Success ALLWAYS! 一直成功
    4. MobileService saved to resources Application.Current.Resources.Add("NavigationParam", App.MobileService); MobileService已保存到资源Application.Current.Resources.Add("NavigationParam", App.MobileService); and Navigating to new project is done. 并导航到新项目。
  • Project 2: 专案2:
    1. Navigation parameter retrieved MobileService = MobileServiceClient)Application.Current.Resources["NavigationParam"]; 检索导航参数MobileService = MobileServiceClient)Application.Current.Resources["NavigationParam"]; (information seems intact when looking into the debugger). (查看调试器时,信息似乎完整无缺)。
    2. Service is contacted await MobileService.InvokeApiAsync<DTO.UserInfoDTO, DTO.UserInfoDTO>(UserInfoDTO); 服务已联系, await MobileService.InvokeApiAsync<DTO.UserInfoDTO, DTO.UserInfoDTO>(UserInfoDTO); Success NEVER! 永无成功

I know the packages are in order in Project 2 because I can upload information to blob storage and the includes are the same in both projects. 我知道这些软件包在Project 2中是有序的,因为我可以将信息上传到Blob存储中,并且两个项目中的包含内容都相同。 But as soon as I contact my own backend service the application crashes with the above exception. 但是,一旦我联系自己的后端服务,应用程序就会崩溃,并出现上述异常。

So can anyone help me with this issue, do I need to create a new mobileserviceclient and reauthenticate? 因此,有谁能帮助我解决这个问题,我是否需要创建一个新的mobileserviceclient并重新进行身份验证? Seems stupid? 看起来很蠢?

I'm not sure what is going wrong, but generally, I would recommend making a new client instance here. 我不确定出了什么问题,但是通常,我建议在这里制作一个新的客户端实例。

To avoid a login issue I would look at caching the mobile service's token. 为了避免登录问题,我将看一下如何缓存移动服务的令牌。 (See: http://azure.microsoft.com/en-us/documentation/articles/mobile-services-windows-dotnet-how-to-use-client-library/#caching ) (请参阅: http : //azure.microsoft.com/zh-cn/documentation/articles/mobile-services-windows-dotnet-how-to-use-client-library/#caching

Then you can spin up a new client, reuse your existing auth tokens/etc, and continue on. 然后,您可以启动一个新客户端,重用您现有的身份验证令牌/等,然后继续。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Windows Phone的Azure移动服务的身份验证问题 - Authentication issues with Azure Mobile Service for Windows Phone 将用户ID从Windows Phone 8.1应用发送到Azure移动服务 - Send User ID from Windows Phone 8.1 App to Azure Mobile Service Windows Phone 8.1应用程序将文件上传到Azure移动应用程序服务 - Windows Phone 8.1 app upload a file to azure mobile app service Windows Azure移动服务:InsertAsync - Windows Azure Mobile Service: InsertAsync 从Azure移动服务获取信息到Windows 8应用 - Get information from Azure Mobile Service to Windows 8 app Windows Phone 7访问Azure移动服务(远程服务器返回错误:未找到) - Windows Phone 7 access Azure Mobile Service (The remote server returned an error: not found) 从Windows服务引用项目 - Referencing Projects from Windows Service 从通过USB电缆直接与Windows机器连接的移动电话访问IIS网站 - Accessing an IIS Website from a mobile phone that is connected via usb cable directly with the windows machine Windows Phone将图像上传到Azure Blob服务 - Windows Phone uploading images to azure blob service 从不同的项目访问appsettings.json - Accessing appsettings.json from different projects
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM