Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/329.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 初始化时出错<;Windows Server中AD FS的自定义身份验证方法>;_C#_Adfs_Multi Factor Authentication_Yubikey - Fatal编程技术网

C# 初始化时出错<;Windows Server中AD FS的自定义身份验证方法>;

C# 初始化时出错<;Windows Server中AD FS的自定义身份验证方法>;,c#,adfs,multi-factor-authentication,yubikey,C#,Adfs,Multi Factor Authentication,Yubikey,我为定制AD FS MFA开发了c#DLL。所以我使用本教程中的 我使用这个powershell命令: Set-Location "C:\Release" [System.Reflection.Assembly]::Load("System.EnterpriseServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a") $publish = New-Object

我为定制AD FS MFA开发了c#DLL。所以我使用本教程中的

我使用这个powershell命令:

Set-Location "C:\Release"
[System.Reflection.Assembly]::Load("System.EnterpriseServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")
$publish = New-Object System.EnterpriseServices.Internal.Publish
$publish.GacInstall("C:\Release\MFAAdapter.dll")
([System.Reflection.Assembly]::LoadFile("C:\Release\MFAAdapter.dll")).FullName
$typeName = "MFAAdapter.Adapter, MFAAdapter, Version=1.0.0.7, Culture=neutral, PublicKeyToken=23251ce4dd11647e, processorArchitecture=MSIL”
Register-AdfsAuthenticationProvider -TypeName $typeName -Name “MFA Adapter” -ConfigurationFilePath 'C:\Release\config.json'
net stop adfssrv
net start adfssrv
但在事件查看器上启动ADFS服务后,会发生以下错误:

An error occurred loading an authentication provider. Fix configuration errors using PowerShell 

cmdlets and restart the Federation Service. 
Identifier: MFA Adapter 
Context: Proxy device TLS pipeline 

Additional Data 
Exception details: 
An error occurred initializing the 'MFA Adapter' authentication provider.
但我的DLL正在加载并进行身份验证。它还加载
TryEndAuthentication()
函数

为什么会发生这种错误

最后:调用OnAuthenticationPipelineLoad()函数的
时还有另一个问题。这样,就根本不调用此函数,也不加载配置文件
(config.json)

public void OnAuthenticationPipelineLoad(IAuthenticationMethodConfigData configData)
    {
        try
        {
            if (configData != null || configData.Data != null)
            {
                using (StreamReader reader = new StreamReader(configData.Data, Encoding.UTF8))
                {
                    var config = reader.ReadToEnd();
                    var obj = JObject.Parse(config);
                    EventLog.WriteEntry(
                        "Application",
                        String.Format("Config loaded for user:{0}. iKey:{1}, user_name, bj["ikey"]]),
                        EventLogEntryType.Information);

                    var ikey = obj["ikey"].ToString();
                }
            }
            else
            {
                EventLog.WriteEntry(
                            "Application",
                            String.Format("Error: configData is null for user:{0}", user_name),
                            EventLogEntryType.Error);
                throw new ArgumentNullException();
            }
        }
        catch (Exception ex)
        {
            EventLog.WriteEntry(
                "Application",
                String.Format("Exception on OnAuthenticationPipelineLoad for user:{0}: {1}", user_name, ex.Message),
                EventLogEntryType.Error);
            throw new ArgumentException(ex.Message);
        }
    }