[wix-users] MSI database update at install time
Stephen Woolhead
stephen at perfectphase.com
Thu Nov 12 12:35:35 PST 2015
This might be me being an idiot, not being a wix expert :)
I have to be able to install our app running as local service, network service or a domain user account. To allow this I have to have this code (simplified), where SERVICEACCOUNTCHOICE has the type of account the user selected.
<!-- Set up UI for use with Local Service account -->
<Component Id="cmp_webUi04" Guid="5932DECF-F4C8-487B-AE1F-437955BFCF26">
<Condition>SERVICEACCOUNTCHOICE=0</Condition>
<iis:WebAppPool Id="LocalServiceAP" Identity="localService" ManagedPipelineMode="integrated" ManagedRuntimeVersion="v4.0" Name="UI App Pool" />
<iis:WebVirtualDir Id="web_vd01" Alias="UI" Directory="dirUI" WebSite="defaultWebSite">
<iis:WebApplication Id="UILocalService" Name="UI" WebAppPool="LocalServiceAP" />
</iis:WebVirtualDir>
</Component>
<!-- Set up UI for use with network Service account -->
<Component Id="cmp_webUi05" Guid="627F5E2E-E7F8-4BAF-95DA-DB1A3E922366">
<Condition>SERVICEACCOUNTCHOICE=1</Condition>
<iis:WebAppPool Id="networkServiceAP" Identity="networkService" ManagedPipelineMode="integrated" ManagedRuntimeVersion="v4.0" Name="UI App Pool" />
<iis:WebVirtualDir Id="web_vd02" Alias="UI" Directory="dirUI" WebSite="defaultWebSite">
<iis:WebApplication Id="UInetworkService" Name="UI" WebAppPool="networkServiceAP" />
</iis:WebVirtualDir>
</Component>
<!-- Set up UI for use with custom account -->
<Component Id="cmp_webUi06" Guid="1A5BE7C1-BECE-4BED-BA1B-F70934F614FD">
<Condition>SERVICEACCOUNTCHOICE=2</Condition>
<utils:User Id="UserAccountService" Name="[SERVICEACCOUNT]" Password="[SERVICEPASSWORD]" CreateUser="no" LogonAsService="yes" RemoveOnUninstall="no"/>
<iis:WebAppPool Id="UserAccountAP" Identity="other" User="UserAccountService" ManagedPipelineMode="integrated" ManagedRuntimeVersion="v4.0" Name="UI App Pool" />
<iis:WebVirtualDir Id="web_vd03" Alias="UI" Directory="dirUI" WebSite="defaultWebSite">
<iis:WebApplication Id="UserAccount" Name="UI" WebAppPool="UserAccountAP" />
</iis:WebVirtualDir>
</Component>
I've tried putting properties in the Identity and User properties but that doesn't seem to work, under the covers there is code in the iis compiler extension
string identityValue = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
if (0 < identityValue.Length)
{
switch (identityValue)
{
case "networkService":
attributes |= 1;
break;
case "localService":
attributes |= 2;
break;
case "localSystem":
attributes |= 4;
break;
case "other":
attributes |= 8;
break;
case "applicationPoolIdentity":
attributes |= 0x10;
break;
default:
this.Core.OnMessage(WixErrors.IllegalAttributeValue(sourceLineNumbers, node.Name, attrib.Name, identityValue, "networkService", "localService", "localSystem", "other", "applicationPoolIdentity"));
break;
}
}
So I can see no way to make this work through the use of standard formatted properties :(
If I only had to deal with a couple of web sites I would stick with the conditioned approach above, but we have quite a few and we're getting a lot of silly mistakes made when devs with limited wix experience create new ones (i.e. copy and past an existing and don't fix up all the ids correctly).
Stephen.
________________________________________
From: wix-users <wix-users-bounces at lists.wixtoolset.org> on behalf of Edwin Castro <egcastr at gmail.com>
Sent: 12 November 2015 18:16
To: WiX Toolset Users Mailing List
Subject: Re: [wix-users] MSI database update at install time
I wrote MSIs 3-4 years ago that installed web services on IIS and we
managed app pool user accounts directly with the IIS extension and
properties. That was a long time ago but I don't remember having trouble.
Out of curiosity, would you mind explaining the issues you're running into
in more detail?
--
Edwin G. Castro
On Thu, Nov 12, 2015 at 9:06 AM, Stephen Woolhead <stephen at perfectphase.com>
wrote:
>
> Thanks everyone for the advice.
>
> It's weird that my attempts to delete rows don't fail, I only get the
> errors on inserts after deletes.
>
> I'm going to switch over to having my custom action create the rows I need
> rather than trying to patch the existing ones.
>
> As to the reason why I want to do this, it mainly relates to creating IIS
> app pools, and the user accounts they run under. The the issue I have is
> that the IIS extension does not easily map the combination of identity type
> and user into a format in the MSI DB that lends it's self to properties, so
> I was trying to fix up the identity at install time via a custom action.
> I'll add that we have a solution at the moment that covers the differences
> using conditions, but this is very verbose in the .wxs files and given the
> scale of our solution this is starting to lead to maintainability issues,
> so we want to codify some of these 'hacks' to make it easier to maintain.
>
> Cheers,
>
> Stephen.
>
> ________________________________________
> From: wix-users <wix-users-bounces at lists.wixtoolset.org> on behalf of
> Edwin Castro <egcastr at gmail.com>
> Sent: 11 November 2015 22:48
> To: WiX Toolset Users Mailing List
> Subject: Re: [wix-users] MSI database update at install time
>
> The Windows Installer does not allow you to delete/modify rows in custom
> actions.
>
> You can add temporary rows using an immediate custom action.
>
> Why do you think you need to update rows at install time? Perhaps you can
> use Formatted strings and properties instead?
>
> --
> Edwin G. Castro
>
> On Wed, Nov 11, 2015 at 2:40 PM, Stephen Woolhead <
> stephen at perfectphase.com>
> wrote:
>
> > Hi, I writing a WiX extension and one of the steps I need my custom
> > actions to do is update existing records in the MSI database at install
> > time.
> >
> >
> > After a bit of research it appears that I can't use SQL UPDATE on
> > permanent tables at install time. Blog posts I've seen [1] say that I
> need
> > to delete and insert a new row, but when I try this I get the following
> > errors:
> >
> >
> > Ready to execute delete query: DELETE FROM `IIsAppPool` WHERE
> > `IIsAppPool`.`AppPool`='web_general_apppool'
> > Delete Query Executed Successfully
> > Ready to execute insert query: INSERT INTO `IIsAppPool` (`AppPool`,
> > `Name`, `Component_`, `Attributes`, `User_`, `RecycleMinutes`,
> > `RecycleRequests`, `RecycleTimes`, `IdleTimeout`, `QueueLimit`, `CPUMon`,
> > `MaxProc`, `VirtualMemory`, `PrivateMemory`, `ManagedRuntimeVersion`,
> > `ManagedPipelineMode`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,
> ?,
> > ?) TEMPORARY
> > Executing insert query...
> > MSI (s) (B8!D0) [22:33:20:906]: Database string pool is corrupted.
> > MSI (s) (B8!D0) [22:33:20:906]: Note: 1: 2259 2: 3: 4:
> > Exception Type: Microsoft.Deployment.WindowsInstaller.InstallerException
> >
> >
> > Is this possible or am I heading down a blind end?
> >
> >
> > Cheer,
> >
> >
> > Stephen.
> >
> >
> >
> >
> > [1]
> >
> http://windows-installer-xml-wix-toolset.687559.n2.nabble.com/Updating-msi-database-install-time-tp7587512p7587523.html
> >
> >
> > ____________________________________________________________________
> > WiX Toolset Users Mailing List provided by FireGiant
> > http://www.firegiant.com/
> >
>
> ____________________________________________________________________
> WiX Toolset Users Mailing List provided by FireGiant
> http://www.firegiant.com/
>
> ____________________________________________________________________
> WiX Toolset Users Mailing List provided by FireGiant
> http://www.firegiant.com/
>
____________________________________________________________________
WiX Toolset Users Mailing List provided by FireGiant http://www.firegiant.com/
More information about the wix-users
mailing list