0

*我正在开发一个商店应用程序。manage.dev.live.com 上的 ClientID 和 Client Secret 已复制到 Azure 门户上我的移动服务的“身份”选项卡以及 manage.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 Message=应用程序未正确配置为使用 Live Connect 服务。要配置您的应用程序,请按照http://go.microsoft.com/fwlink/?LinkId=220871上的说明进行操作。Source=Microsoft.Live ErrorCode=invalid_request StackTrace: at Microsoft.Live.LiveAuthClient.d_ 4.MoveNext() --- 从先前抛出异常的位置结束堆栈跟踪 --- 在 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (任务任务)在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)在 System.Runtime.CompilerServices.TaskAwaiter1.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.TaskAwaiter1.GetResult() at Microsoft.Live.TailoredAuthClient.d _12.MoveNext() --- 从先前抛出异常的位置结束堆栈跟踪 --- 在 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) 在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult() at 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();
                }

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

4

1 回答 1

2

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

您需要将您的应用程序关联到您的 Windows 应用商店帐户,然后您才能使用 Live 服务和推送通知。

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