首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 ><util:未使用更新值的用户/>属性引用

<util:未使用更新值的用户/>属性引用
EN

Stack Overflow用户
提问于 2013-03-26 22:55:15
回答 1查看 607关注 0票数 1

我试图使用<util:User Id="UpdateServiceAccountLogonAsService" UpdateIfExists="yes" CreateUser="no" Name="[SERVICEACCOUNTFULL]" LogonAsService="yes"/>将logonAsService授予用户界面指定的用户。此属性值在此util之前更新:用户在运行时得到处理。

我之所以知道这一点,是因为我可以给SERVICEACCOUNTFULL属性一个默认值"localhost\defaultUserValue“,并设置CreateUser="yes”,并且它将生成一个运行时消息框错误,在我的自定义操作设置属性值之后显示原始值。不知道为什么不能创建用户,但它显示了正确的时间。如果我将属性默认值硬编码到我将其设置为动态(使用CreateUser="no")的值,它就能工作。

作为同一组件的一部分,我拥有的<ServiceInstall />标记正确地使用了该属性的更新值,但<util:User />不会。

请记住,我正在验证createUser步骤是否发生在设置属性值的自定义操作程序之后。但是现在我要提到这一点,奇怪的是,createUser操作执行就在日志中,正好在获取属性值和其Before="InstallFiles"的自定义操作之上。

帮助?谢谢!

===========

嗨罗布

不太确定你需要看到什么,但我认为这些是相关的:

代码语言:javascript
复制
<Component Id="Service" Guid='*'>
  <File Source='$(var.root)My Service.exe' />
  <ServiceInstall Id="ServiceInstall"
    Name="MyServer"
    DisplayName="My Server"
    Type="ownProcess"
    Start="auto"
    ErrorControl="normal"
    Description="My Server Windows Service"
    Interactive="no"
    Account="[SERVICEACCOUNTFULL]"
    Password="[SERVICEACCOUNTPASSWORD]" />
  <ServiceControl Id="StopMyServer" Name="MyServer" Stop="both" Wait="yes" Remove="uninstall" />
  <util:User Id="UpdateServiceAccountLogonAsService" UpdateIfExists="yes" 
    CreateUser="no" Name="[SERVICEACCOUNTFULL]" LogonAsService="yes"/>
</Component>

...

<Binary Id="ConfigBinary" SourceFile="$(var.....TargetDir)$(var.Configuration.TargetName).CA.exe" />

<Property Id="Net">net.exe</Property>
<CustomAction Id="NetStart" Property="Net" ExeCommand="START MyServer" Return="check" />

<Property Id="PerformNetStart" Value="0" />
<CustomAction Id='SetPerformNetStart' Property='PerformNetStart' Value='1' />
<CustomAction Id="RunConfiguration" BinaryKey="ConfigBinary" DllEntry="RunConfiguration" Execute="immediate" Return="check" />
<CustomAction Id='IsPrivileged' Error='You must be an admin to install this feature' />

<InstallExecuteSequence>
    <Custom Action='IsPrivileged' Before='RunConfiguration'>
    <![CDATA[Not Privileged AND &FeatureServer > 2 ]]>
    </Custom>
    <Custom Action="RunConfiguration" Before="InstallFiles">
    <![CDATA[&FeatureServer > 2 AND Not Installed ]]>
    </Custom>
    <Custom Action="SetPerformNetStart" Before="InstallFiles">
    <![CDATA[&FeatureServer > 2 AND Not Installed ]]>
    </Custom>
    <Custom Action="NetStart" After="InstallFinalize">
    PerformNetStart = 1
    </Custom>
</InstallExecuteSequence>

然后在C#中:

代码语言:javascript
复制
public static ActionResult RunConfiguration(Session session)
{
    session["SERVICEACCOUNTFULL"] = "MyDomain\svcAccount";
    session["SERVICEACCOUNTPASSWORD"] = "secret;

    return ActionResult.Success;
}

以下是硬编码有效值运行的日志:

代码语言:javascript
复制
MSI (s) (F0:F8) [18:29:29:191]: Created Custom Action Server with PID 4796 (0x12BC).
MSI (s) (F0:CC) [18:29:29:211]: Running as a service.
MSI (s) (F0:CC) [18:29:29:213]: Hello, I'm your 32bit Impersonated custom action server.
MSI (s) (F0!48) [18:29:29:240]: PROPERTY CHANGE: Adding CreateUserRollback property. Its value is '**********'.
MSI (s) (F0!48) [18:29:29:243]: Doing action: CreateUserRollback
Action 18:29:29: CreateUserRollback. 
Action start 18:29:29: CreateUserRollback.
CreateUserRollback: 
Action ended 18:29:29: CreateUserRollback. Return value 1.
MSI (s) (F0!48) [18:29:29:247]: PROPERTY CHANGE: Adding CreateUser property. Its value is '**********'.
MSI (s) (F0!48) [18:29:29:247]: Doing action: CreateUser
Action 18:29:29: CreateUser. 
Action start 18:29:29: CreateUser.
CreateUser: 
Action ended 18:29:29: CreateUser. Return value 1.
Action ended 18:29:29: ConfigureUsers. Return value 1.
MSI (s) (F0:F0) [18:29:29:252]: Skipping action: IsPrivileged (condition is false)
MSI (s) (F0:F0) [18:29:29:252]: Doing action: RunConfiguration
Action 18:29:29: RunConfiguration. 
Action start 18:29:29: RunConfiguration.
MSI (s) (F0:E0) [18:29:29:286]: Invoking remote custom action. DLL: C:\Windows\Installer\MSIC008.tmp, Entrypoint: RunConfiguration
SFXCA: Extracting custom action to temporary directory: C:\Users\Jason\AppData\Local\Temp\MSIC008.tmp-\
SFXCA: Binding to CLR version v4.0.30319
Calling custom action ...Configuration!...RunConfiguration
Begin RunConfiguration
Setting MSI values from RunConfiguration
MSI (s) (F0!48) [18:29:47:629]: PROPERTY CHANGE: Modifying RUNTIMECONNECTIONSTRING property. Its current value is 'DEFAULT'. Its new value: 'Data Source=.;Initial Catalog=DB;Integrated Security=True'.
MSI (s) (F0!48) [18:29:47:629]: PROPERTY CHANGE: Modifying SERVICEACCOUNTFULL property. Its current value is 'MyDomain\DEFAULTVALUE'. Its new value: 'MyDomain\svcAccount'.
...
Returning from RunConfiguration

它是按向后顺序登录的,这将解释问题的原因,但当我在CreateUser操作错误上输出CreateUser=“是”时,显然会在配置自定义操作返回之后发生几次。但是也许它是以某种奇怪的方式排队的,而执行的顺序才是问题所在--在这种情况下,我仍然不知道如何控制这个顺序。

这是你诊断的好信息吗?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-03-27 04:41:36

问题是,设置要由User元素使用的属性的自定义操作User运行得太晚了。而不是在RunConfiguration之前调度InstallFiles,而是在ConfigureUsers之前调度操作。类似于:

代码语言:javascript
复制
<Custom Action="RunConfiguration" Before="ConfigureUsers">
<![CDATA[&FeatureServer > 2 AND Not Installed ]]>
</Custom>
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/15648940

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档