Azure移动服务应用程序崩溃并显示消息 - 未正确配置应用程序以使用Live Connect服务

时间:2013-06-07 02:54:45

标签: azure windows-8 azure-mobile-services

* 我正在开发一个商店应用.thift.dev.live.com上的ClientID和Client Secret已被复制到Azure门户上我的移动服务的“身份”标签和管理上的重定向域.dev和Azure门户匹配。 此外,我已将我的商店应用程序与来自VS内部的manage.dev.live.com中的应用程序相关联。 但我仍然在我的应用程序中收到错误。 *仅供参考我正在使用dev.live.com和Azure Portal的不同实时帐户,我不知道这是否有任何影响。在放置断点时,错误发生在以下行 -

 LiveLoginResult result = await liveidclient.LoginAsync(new[] { "wl.basic" });

顺便说一句,我确实得到登录提示输入用户名和密码。单击确定后,应用程序崩溃并显示消息 - 未正确配置应用程序以使用Live Connect服务。要配置您的应用,请按照

上的说明进行操作

嗨,这是我的例外细节 -

Microsoft.Live.LiveAuthException未处理       的HResult = -2146233088       消息=未正确配置应用程序以使用Live Connect服务。要配置您的应用,请按照http://go.microsoft.com/fwlink/?LinkId=220871上的说明操作。       来源= Microsoft.Live       错误码= INVALID_REQUEST       堆栈跟踪:            在Microsoft.Live.LiveAuthClient.d_ 4.MoveNext()         ---从抛出异常的先前位置开始的堆栈跟踪结束---            在System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)            在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)            在System.Runtime.CompilerServices.TaskAwaiter 1.GetResult() at DeltaVMobile.MainPage.<Authenticate>d__4.MoveNext() in MainPage.xaml.cs:line 99 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at DeltaVMobile.MainPage.<OnNavigatedTo>d__0.MoveNext() in MainPage.xaml.cs:line 75 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.AsyncMethodBuilderCore.<ThrowAsync>b__0(Object state) at System.Threading.WinRTSynchronizationContext.Invoker.InvokeCore() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem() at System.Threading.ThreadPoolWorkQueue.Dispatch() InnerException: HResult=-2138701823 Message=Authentication target is invalid or not configured correctly. (Exception from HRESULT: 0x80860001) Source=mscorlib StackTrace: at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter 1.GetResult()                 在Microsoft.Live.TailoredAuthClient.d _12.MoveNext()              ---从抛出异常的先前位置开始的堆栈跟踪结束---                 在System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)                 在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)                 在System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()                 在Microsoft.Live.TailoredAuthClient.d__0.MoveNext()            InnerException:

以下是我正在使用的代码

LiveAuthClient liveidclient = new LiveAuthClient("https://deltavauth.azure-mobile.net/");

            while (session == null)
            {
                if (liveidclient.CanLogout)
                {
                    liveidclient.Logout();
                }

                LiveLoginResult result = await liveidclient.LoginAsync(new[] { "wl.basic" });
                if (result.Status == LiveConnectSessionStatus.Connected)
                {
                    session = result.Session;
                    LiveConnectClient client = new LiveConnectClient(result.Session);
                    LiveOperationResult mresult = await client.GetAsync("me");
                    MobileServiceUser loginresult = await App.MobileService.LoginWithMicrosoftAccountAsync(result.Session.AuthenticationToken);
                    string title = string.Format("Welcome {0} !", mresult.Result["first_name"]);
                    var message = string.Format("You are now logged in -{0}", loginresult.UserId);
                    var dialog = new MessageDialog(title);
                    dialog.Commands.Add(new UICommand("OK"));
                    await dialog.ShowAsync();

                }
                else
                {
                    session = null;
                    var dialog = new MessageDialog("You must login to use DeltaV", "Login Required");
                    dialog.Commands.Add(new UICommand("OK"));
                    await dialog.ShowAsync();
                }

仅供参考,这是教程的网址 - http://www.windowsazure.com/en-us/develop/mobile/tutorials/single-sign-on-windows-8-dotnet/

1 个答案:

答案 0 :(得分:2)

https://manage.dev.live.com/已弃用

您需要将应用与Windows应用商店帐户相关联,然后才能使用直播服务&amp;推送通知。

  1. 右键单击项目名称。
  2. 点击“商店”菜单。
  3. 点击“将应用与商店关联”。
  4. 它会提示您登录。使用您的商店帐户登录。
  5. 点击您应用的保留名称(我认为您必须保留您的应用名称,否则请转到Windows Store Dashboard并先保留。)
  6. 按照提示的其他过程进行操作。
  7. 您的项目将获得Store Key&amp;新Package Identity。因此,它将允许您利用Live服务&amp;推送通知。