简体   繁体   English

Windows安装程序使用NT AUTHORITY \\ SYSTEM而不是登录用户

[英]Windows installer using the NT AUTHORITY\SYSTEM instead of login user

I have a windows installer, which is creating a database as a part of the installation process. 我有一个Windows安装程序,它正在创建一个数据库作为安装过程的一部分。 While installing the application CREATE DATABASE process is failing because the windows installer using a wrong user. 安装应用程序CREATE DATABASE过程失败,因为Windows安装程序使用了错误的用户。 It is using NT AUTHORITY\\SYSTEM instead of using the login user. 它使用NT AUTHORITY\\SYSTEM而不是使用登录用户。 NT AUTHORITY\\SYSTEM user does not have permission to create a database. NT AUTHORITY\\SYSTEM用户无权创建数据库。

Is there any way to force the installer to use the login user? 有没有办法强制安装程序使用登录用户?

Using Windows 10 environment with VS 2017 and MS Visual Studio 2017 Installer Projects. 在VS 2017和MS Visual Studio 2017安装程序项目中使用Windows 10环境。

The short answer is that you can't do this in a Visual Studio setup that is an InstallAllUsers setup because the all VS installer generated custom actions run as the system account. 简短的回答是,您无法在安装了InstallAllUsers的Visual Studio安装程序中执行此操作,因为所有VS安装程序生成的自定义操作都作为系统帐户运行。 Therefore you'd need to change the custom action settings in the MSI file with an editing tool such as Orca. 因此,您需要使用Orca等编辑工具更改MSI文件中的自定义操作设置。 You'd find the custom action in the CustomAction table in the MSI file, look at the Type values (it's probably a type 3074) and then turn off the msidbCustomActionTypeNoImpersonate bit so that it runs impersonated as the installing user. 您可以在MSI文件的CustomAction表中找到自定义操作,查看Type值(它可能是类型3074),然后关闭msidbCustomActionTypeNoImpersonate位,以便它作为安装用户模拟运行。

https://msdn.microsoft.com/en-us/library/windows/desktop/aa368069(v=vs.85).aspx https://msdn.microsoft.com/en-us/library/windows/desktop/aa368069(v=vs.85).aspx

Note that running impersonated as the installing user has its own set of issues because it is NOT the same as running as the interactive user. 请注意,作为安装用户运行模拟有自己的一组问题,因为它与运行交互式用户不同。 The user profile is not loaded, so objects associated with the user (such as HKCU, user profile folders) are very unreliable. 未加载用户配置文件,因此与用户关联的对象(例如HKCU,用户配置文件文件夹)非常不可靠。

Many people populate the databases with a separate programs the first time the application is launched so that it runs properly as the interactive user and can be developed and debugged as a standalone program. 许多人在第一次启动应用程序时使用单独的程序填充数据库,以便它作为交互式用户正常运行,并且可以作为独立程序进行开发和调试。 If the populate fails during the install you either give up the install and roll back, or you continue the install and end up with an empty database, for which you might need a program to populate it anyway. 如果在安装过程中填充失败,您要么放弃安装并回滚,要么继续安装并最终得到一个空数据库,为此您可能需要一个程序来填充它。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 用户NT Authority \\ System登录失败 - Login failed for user NT Authority\System 无法打开登录请求的数据库。 用户“NT AUTHORITY\\SYSTEM”登录失败。 Quartz 调度程序 Windows 服务 - Cannot open database requested by the login. Login failed for user 'NT AUTHORITY\SYSTEM'. Quartz Scheduler Windows Services 登录失败。 用户“NT AUTHORITY\\SYSTEM”登录失败 - Login failed. Login failed for user 'NT AUTHORITY\SYSTEM' 无法打开登录请求的数据库。 登录失败。 用户“ NT AUTHORITY \\ SYSTEM”的登录失败 - Cannot open database requested by the login. The login failed. Login failed for user 'NT AUTHORITY\SYSTEM' 用户“ NT AUTHORITY \\ SYSTEM”的登录失败。 原因:无法打开明确指定的数据库 - Login failed for user 'NT AUTHORITY\SYSTEM'. Reason: Failed to open the explicitly specified database System.Data.SqlClient.SqlException:用户“NT AUTHORITY\\ANONYMOUS LOGON”登录失败 - System.Data.SqlClient.SqlException: Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON' 如何使用C#在Window OS中的系统NT Authority\System下创建新用户 - How to Create New User under NT Authority\System the System in Window OS using C# SqlException:无法打开登录请求的数据库“ path \\ db.mdf”。 登录失败。 用户“ NT AUTHORITY \\ SYSTEM”的登录失败 - SqlException: Cannot open database “path\db.mdf” requested by the login. The login failed. Login failed for user 'NT AUTHORITY\SYSTEM' LocalDb-> Windows服务->无法打开登录请求的数据库“”。 登录失败。 用户“ NT AUTHORITY \\ LOCAL SERVICE”的登录失败 - LocalDb -> Windows Service -> Cannot open database “” requested by the login. The login failed. Login failed for user 'NT AUTHORITY\LOCAL SERVICE' 调试模式下的 Windows.Identity 返回 NT 用户名,但在发布到服务器时返回 NT AUTHORITY\\SYSTEM - Windows.Identity in debug mode returns NT username, but returns NT AUTHORITY\SYSTEM when published to server
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM