WiX自定义Action注册自定义ADFS认证提供者。

问题描述 投票:0回答:1

我在关注微软的 在Windows Server中为AD FS构建自定义认证方法 指南,为ADFS构建一个自定义的身份验证提供商,我在部署步骤,其中规定。

适配器提供商必须提供一个安装程序来执行必要的安装操作,包括在GAC中的安装,并且安装程序必须支持在AD FS中注册。

我成功地使用WiX将适配器安装到GAC中,并使用PowerShell将其手动注册到ADFS中,但当我试图让WiX通过一个 "自动 "程序将提供商注册到ADFS中时,我从Windows安装程序中得到一个错误。CustomAction: Error 1721. There is a problem with this Windows Installer package. A program required for this install to complete could not be run. Contact your support personnel or package vendor.

完整的日志如下所示。

MSI (s) (E4:78) [10:02:27:412]: Executing op: ActionStart(Name=RegisterAdfsProvider,,)
MSI (s) (E4:78) [10:02:27:413]: Executing op: CustomActionSchedule(Action=RegisterAdfsProvider,ActionType=3106,Source=C:\,Target=Register-AdfsAuthenticationProvider -TypeName "MyAuthenticationAdapter.MyAdapter, MyAuthenticationAdapter, version=1.0.0.0, culture=neutral, publicKeyToken=D006C127CE4A16A7, processorArchitecture=MSIL" -Name MyAuthenticationProvider,)
MSI (s) (E4:78) [10:02:27:416]: Note: 1: 1721 2: RegisterAdfsProvider 3: C:\ 4: Register-AdfsAuthenticationProvider -TypeName "MyAuthenticationAdapter.MyAdapter, MyAuthenticationAdapter, version=1.0.0.0, culture=neutral, publicKeyToken=D006C127CE4A16A7, processorArchitecture=MSIL" -Name MyAuthenticationProvider 
MSI (s) (E4:78) [10:02:27:416]: Note: 1: 2205 2:  3: Error 
MSI (s) (E4:78) [10:02:27:416]: Note: 1: 2228 2:  3: Error 4: SELECT `Message` FROM `Error` WHERE `Error` = 1721 
MSI (c) (0C:B0) [10:02:27:429]: Font created.  Charset: Req=0, Ret=0, Font: Req=MS Shell Dlg, Ret=MS Shell Dlg

Error 1721. There is a problem with this Windows Installer package. A program required for this install to complete could not be run. Contact your support personnel or package vendor. Action: RegisterAdfsProvider, location: C:\, command: Register-AdfsAuthenticationProvider -TypeName "MyAuthenticationAdapter.MyAdapter, MyAuthenticationAdapter, version=1.0.0.0, culture=neutral, publicKeyToken=D006C127CE4A16A7, processorArchitecture=MSIL" -Name MyAuthenticationProvider 
MSI (s) (E4:78) [10:02:28:198]: Note: 1: 2205 2:  3: Error 
MSI (s) (E4:78) [10:02:28:198]: Note: 1: 2228 2:  3: Error 4: SELECT `Message` FROM `Error` WHERE `Error` = 1709 
MSI (s) (E4:78) [10:02:28:198]: Product: MyAuthenticationAdapter -- Error 1721. There is a problem with this Windows Installer package. A program required for this install to complete could not be run. Contact your support personnel or package vendor. Action: RegisterAdfsProvider, location: C:\, command: Register-AdfsAuthenticationProvider -TypeName "MyAuthenticationAdapter.MyAdapter, MyAuthenticationAdapter, version=1.0.0.0, culture=neutral, publicKeyToken=D006C127CE4A16A7, processorArchitecture=MSIL" -Name MyAuthenticationProvider 

Action ended 10:02:28: InstallFinalize. Return value 3.

如果我从日志中复制命令,然后在PowerShell中手动运行,它就会成功完成。我在PowerShell中的代码 .wxs 文件如下。

<SetProperty  Id="ADFS_PROVIDER_TYPE_NAME"
              Value="MyAuthenticationAdapter.MyAdapter, !(bind.assemblyFullName.MyAuthenticationAdapter)"
              Before="RegisterAdfsProvider"
              Sequence="execute"/>
<CustomAction Id="RegisterAdfsProvider"
              Directory="TARGETDIR"
              ExeCommand="Register-AdfsAuthenticationProvider -TypeName &quot;[ADFS_PROVIDER_TYPE_NAME]&quot; -Name MyAuthenticationProvider"
              Execute="deferred"
              Impersonate="no"/>
<InstallExecuteSequence>
  <Custom Action="RegisterAdfsProvider" Before="InstallFinalize">NOT Installed AND NOT REMOVE~="ALL"</Custom>
</InstallExecuteSequence>

我的WiX文件有什么问题导致在安装过程中出现这个错误?

active-directory wix windows-installer adfs
1个回答
0
投票

原来的错误是正确的。我通过几种不同的执行命令的方法,才意识到我试图运行的命令实际上是一个PowerShell Cmdlet,它不能被执行,虽然 ExeCommand 属性的CustomAction。我是通过运行 gcm "Register-AdfsAuthenticationProvider" 在PowerShell中,得到这样的输出。

CommandType   Name                                  Version   Source
-----------   ----                                  -------   ------
Cmdlet        Register-AdfsAuthenticationProvider   1.0.0.0   ADFS
© www.soinside.com 2019 - 2024. All rights reserved.