通过 UWP 应用程序连接到 Azure AD 会IdentityModel.OidcClient
生成如下错误。
异常消息 =“指定的协议未知。(来自 HRESULT 的异常:0x800C000D)”在堆栈跟踪中注意重要!
函数内部发生异常public class WabBrowser : IBrowser
。InvokeAsyncCore(BrowserOptions options, bool silentMode)
代码:
public class WabBrowser : IBrowser
{
private readonly bool _enableWindowsAuthentication;
public WabBrowser(bool enableWindowsAuthentication = false)
{
_enableWindowsAuthentication = enableWindowsAuthentication;
}
private async Task<BrowserResult> InvokeAsyncCore(BrowserOptions options, bool silentMode)
{
var wabOptions = WebAuthenticationOptions.UseHttpPost;
if (_enableWindowsAuthentication)
{
wabOptions |= WebAuthenticationOptions.UseCorporateNetwork;
}
if (silentMode)
{
wabOptions |= WebAuthenticationOptions.SilentMode;
}
WebAuthenticationResult wabResult;
try
{
if (string.Equals(options.EndUrl, WebAuthenticationBroker.GetCurrentApplicationCallbackUri().AbsoluteUri, StringComparison.Ordinal))
{
wabResult = await WebAuthenticationBroker.AuthenticateAsync(
wabOptions, new Uri(options.StartUrl));
}
else
{
if (string.IsNullOrWhiteSpace(options.EndUrl))
{
wabResult = await WebAuthenticationBroker.AuthenticateAsync(
wabOptions, new Uri(options.StartUrl), WebAuthenticationBroker.GetCurrentApplicationCallbackUri());
}
else
{
wabResult = await WebAuthenticationBroker.AuthenticateAsync(
wabOptions, new Uri(options.StartUrl), new Uri(options.EndUrl));
}
}
}
catch (Exception ex)
{
Utility.WriteErrorsToLogViaMessenger("WabBrowser-InvokeAsyncCore", ex);
return new BrowserResult
{
ResultType = BrowserResultType.UnknownError,
Error = ex.ToString()
};
}
}
此问题仅在连接到其他身份服务器时发生,Azure AD
并且在连接到其他身份服务器时,此实现工作正常。任何帮助,将不胜感激。