MSI安装程序自定义操作身份问题 [英] MSI installer custom action identity problem

查看:70
本文介绍了MSI安装程序自定义操作身份问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个自定义操作,该操作在数据库上执行脚本.问题是connectios使用集成的安全性,因此当我尝试打开连接时出现错误:用户'Domain \ ComputerName $'登录失败.

I'm creating a custom action that executes a script on a database. The problem is that the connectios uses intergrated security, so when I try to open the connection i get the error: Login Failed for user 'Domain\ComputerName$'.

当我检查自定义操作的身份(使用System.Security.Principal.WindowsIdentity.GetCurrent())时,我总是得到"NT AUTHORITY \ SYSTEM" 但是我正在我的帐户下运行安装程序,该帐户对数据库具有足够的特权.

When i check the identity on the custom action (using System.Security.Principal.WindowsIdentity.GetCurrent()) I always get "NT AUTHORITY\SYSTEM" but I'm running the installer under my account which has enough privileges on the Database.

如何在真实用户runnig的msi文件下运行自定义操作,或以其他任何方式解决此问题?

How can I run the custom action under the real user runnig the msi file or solve this problem in any other way?

推荐答案

嗯,有一个简单的解决方案,但可能并不适合所有情况.

Well, there's a simple solutions for this but maybe it's not suitable for all cases.

如果您将项目属性设置为 InstallAllUsers 确实,安装程序使用"NT AUTHORITY \ SYSTEM" 帐户运行,但是如果将其设置为false,则它将以启动安装程序的用户的身份运行.

If you set the project property of InstallAllUsers To true, the installer runs with "NT AUTHORITY\SYSTEM" Account, but if you set it to false it runs with the identity of the user who launches the installer.

将其设置为false对我来说是可行的,即使我正在安装为所有用户运行的Windows服务.

Setting it to false worked for me, even that I was installing a Windows Service that runs for all users.

这篇关于MSI安装程序自定义操作身份问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆