IIS的CustomAction错误:UnauthorizedAccessException

时间:2013-06-11 22:27:36

标签: wix

双击我的MSI包时出现以下异常

CustomActionException: System.UnauthorizedAccessException: Filename: redirection.config
Error: Cannot read configuration file due to insufficient permissions


   at Microsoft.Web.Administration.Interop.AppHostWritableAdminManager.GetAdminSection(String bstrSectionName, String bstrSectionPath)
   at Microsoft.Web.Administration.Configuration.GetSectionInternal(ConfigurationSection section, String sectionPath, String locationPath)
   at Microsoft.Web.Administration.ServerManager.get_SitesSection()
   at Microsoft.Web.Administration.ServerManager.get_Sites()
...

这样做是因为它试图从自定义操作中访问路径C:\ Windows \ System32 \ inetsrv \ config

现在,如果我从PowerShell运行MSI,您以管理员身份运行,它似乎工作正常,但默认的双击调用不起作用

除了将自己添加到该文件夹​​的UAC之外,我的CustomActions是否仍然可以使用提升的权限运行?

我尝试了InstallPrivileges =“raise”的Package-level属性,但没有效果

1 个答案:

答案 0 :(得分:1)

默认情况下,您需要使用Bootstrapper以管理模式运行msi。你可以使用Wix Bootstrapper来做到这一点。或者,您可以使用WinZip Self extractorInno Setup等任何第三方工具来运行msi文件。它将始终以管理员身份运行msi。