本文介绍了WebAuthenticationBroker.AuthenticateAsync引发异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的代码使用:

WebAuthenticationResult WebAuthenticationResult = await
WebAuthenticationBroker.AuthenticateAsync( 
                                        WebAuthenticationOptions.None, 
                                        StartUri, 
                                        EndUri); 

就像 Microsoft Web身份验证代理示例

它曾经可以在我的台式机和平板电脑(曲面)上运行,但现在在我的台式机上无法运行.引发异常

It used to work on my desktop and on my tablet (Surface) but now it is not working on my desktop. It throws exception

The process terminated unexpectedly. (Exception from HRESULT: 0x8007042B)

它可以在平板电脑和其他Windows-8桌面上运行.

It is working on the tablet and on different windows-8 desktop.

有什么建议可以导致此异常?

Any suggestion what can cause this exception?

推荐答案

WebAuthenticationBroker.AuthenticateAsync作为应用程序进程的子级启动AuthHost.exe进程,并且异常返回的HRESULT指示AuthHost.exe意外失败.启动时,AuthHost尝试从非sso容器中清除cookie,内容和历史记录,如果失败,则退出.另一方面,Windows应用程序在沙箱中运行,该沙箱具有一组权限,不同于桌面应用程序.因此,Internet Explorer本身或执行SSO的桌面应用程序可能可以正常工作,但是AuthHost不允许在启动时进行必需的清理.就我而言,运行该应用程序的用户属于该组的一部分,该组被授予对该文件夹的完全访问权限,但该用户本身没有直接的文件访问权限.但是,组权限在应用程序沙箱中被剥夺了.在默认设置中,权限配置正确,并且不会出现此类问题.但是,在某些情况下,用户会将Internet临时文件移动到新位置,该位置可能具有稍微不同的文件访问权限集.关于此线程的另一个响应表明,删除和重新创建配置文件会有所帮助.此操作将Internet Explorer中的"Internet临时文件"设置重置为默认值,间接支持我的建议.

WebAuthenticationBroker.AuthenticateAsync kicks off AuthHost.exe process as a child of the app process, and the HRESULT returned by the exception indicates that AuthHost.exe failed unexpectedly. When launched, AuthHost tries to purge cookies, content and history from non sso containers, and if it fails, it backs off. On the other side, a Windows App runs in a sandbox with a set of permissions different from a desktop application. Thus Internet Explorer itself or a desktop application doing SSO might be able to work normally, but AuthHost will not be allowed to do required clean up on start. In my case, a user running the app was a part of the group that was granted full access to the folder, but the user itself did not have direct file access permissions. However, the group rights got stripped off in the app sandbox.In a default set up, permissions are configured properly, and no such problems should arise. However, in come cases a user moves the Temporary Internet Files to a new location, which might have a slightly different set of file access permissions. The other response on this thread suggests that deleting and re-creating profile helps. This operation resets Temporary Internet Files settings in the Internet Explorer to default, indirectly supporting my suggestion.

这篇关于WebAuthenticationBroker.AuthenticateAsync引发异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-31 20:46