在没有Internet连接的情况下尝试登录SkyDrive时,LoginAsync()挂起 [英] LoginAsync() Hangs When Attempting to Log Into SkyDrive with No Internet Connection
问题描述
你好
我无法正确调用Windows Live API中的auth.LoginAsync()以正常异常。
I am unable to get the call to auth.LoginAsync() in the Windows Live API to exception correctly.
当我连接到互联网时,此呼叫正常工作(它成功登录我然后我可以访问我的SkyDrive文件)。
但是,如果我没有连接到互联网,它只是无限期挂起。
This call works correctly when I am connected to the internet (it successfully logs me in and I can then access my SkyDrive files).
However, if I am not connected to the internet, it simply hangs indefinitely.
我无法找到有关该主题的任何合适的文档,或找到解决方法。
I have not been able to find any suitable documentation on the subject, or to find a workaround.
这是我的代码:
LiveAuthClient auth = new LiveAuthClient("< XXXXXX>");
LiveLoginResult loginResult = await auth.LoginAsync(new string [] {" wl.basic"," wl.skydrive"," wl.skydrive_update"," wl.signin"," wl.offline_access"});
LiveAuthClient auth = new LiveAuthClient("<XXXXXX>");
LiveLoginResult loginResult = await auth.LoginAsync(new string[] { "wl.basic", "wl.skydrive", "wl.skydrive_update", "wl.signin", "wl.offline_access" });
推荐答案
您好Geoff,
Hi Geoff,
您应该在尝试登录前测试网络连接。
You should test for network connectivity before attempting the login.
http:/ /msdn.microsoft.com/en-us/library/windowsphone/develop/hh487166(v=vs.105).aspx
您还可以尝试Window Live 关于在这种情况下使用API的建议的开发者论坛。
You can also try the Window Live Developer forum for advice on using their APIs in this situation.
最后你可以启动任务,但是如果任务超过带有取消令牌的超时值,则可以取消任务并取消任务等待时间类似于:
http://msdn.microsoft.com/en-us/library/windowsphone/ develop / dd235606(v = vs.105).aspx
Finally you could kick off the task but have a time out and cancel the task if it exceeds a timeout value with a cancellation token or Wait timout similar to this: http://msdn.microsoft.com/en-us/library/windowsphone/develop/dd235606(v=vs.105).aspx
您也可以使用Login Control代替此API(最常见)。
You can also use the Login Control instead of this API (most common).
这篇关于在没有Internet连接的情况下尝试登录SkyDrive时,LoginAsync()挂起的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!