install asp.net application on IIS using wix without IIS backward compatibilty on - wix

I have created WiX installer that installs website in IIS but I have to keep IIS backward compatibility on.
<Component Id="VirtualDirectoryWebAppPool" Guid="{GIUD}" Permanent="yes">
<iis:WebAppPool Id="WebAppPool" Name="${ProductName}" ManagedRuntimeVersion="v4.0" ManagedPipelineMode="integrated" />
<CreateFolder />
</Component>
<Component Id="VirtualDirectoryWithoutWinAuth" Guid="{GUID}" Permanent="yes">
<Condition>TYPEOFAUTHENTICATION = "Forms"</Condition>
<iis:WebVirtualDir Id="WebVirtualDirectoryWithoutWinAuth" Alias="[VDNAME]" Directory="WEBUIFOLDER" WebSite="DefaultWebSite" >
<iis:WebApplication Id="WebApplicationWithoutWinAuth" Name="[VDNAME]" WebAppPool="WebAppPool" />
<iis:WebDirProperties Id="WebDirectoryPropertiesWithoutWinAuth" AnonymousAccess="yes" WindowsAuthentication="no" />
</iis:WebVirtualDir>
<CreateFolder />
</Component>
<Component Id="VirtualDirectoryWithWinAuth" Guid="{GIUD}" Permanent="yes">
<Condition>TYPEOFAUTHENTICATION = "Windows"</Condition>
<iis:WebVirtualDir Id="WebVirtualDirectoryWithWinAuth" Alias="[VDNAME]" Directory="WEBUIFOLDER" WebSite="DefaultWebSite" >
<iis:WebApplication Id="WebApplicationWithWinAuth" Name="[VDNAME]" WebAppPool="WebAppPool" />
<iis:WebDirProperties Id="WebDirectoryPropertiesWithWinAuth" AnonymousAccess="yes" WindowsAuthentication="yes" />
</iis:WebVirtualDir>
<CreateFolder />
</Component>
...
<iis:WebSite Id="DefaultWebSite" Description="Default Web Site" Directory="WEBUIFOLDER">
<iis:WebAddress Id="AllUnassigned" Port="80" />
</iis:WebSite>
But I do not want to keep the IIS backward compatibility on.

Related

Issue with Wix not creating IIS pool before running SQL setup scripts

I'm writing a Wix msi that needs to create a database, configure IIS and then run a few SQL setup scripts. The issue I'm running into is that the SQL scripts seem to be running before IIS has completed configuration with the appropriate pool / website. One of the SQL scripts relies on the IIS being configured and causes the installer to fail:
Here's what I have (Relevant parts pulled out of various *.wxs files):
Main.wxs:
<Feature Id="ProductFeature" Title="SamplePortalApi.Setup" Level="1">
<ComponentGroupRef Id="SamplePortalApiComponents" />
<ComponentGroupRef Id="MyIISConfiguration" />
<ComponentRef Id="SqlComponent" /> <!-- Database Setup / Scripts Run Here -->
</Feature>
ConfigureIIS.wxs:
<DirectoryRef Id="INSTALLFOLDER">
<Component Id="SamplePortalAppPool" Guid="" KeyPath="yes">
<iis:WebAppPool Id="SamplePortalAppPool"
Name="SamplePortalApi"
Identity="applicationPoolIdentity"
ManagedPipelineMode="Integrated"
ManagedRuntimeVersion="v4.0" />
</Component>
<Component Id="InstallWebsite" Guid="" KeyPath="yes">
<iis:WebSite Id="SamplePortalApi" Description='SamplePortalApi' Directory='INSTALLFOLDER' AutoStart='no' StartOnInstall='no'>
<iis:WebAddress Id="AllUnassigned" Port="[DB_PORT]" />
<iis:WebApplication Id="SamplePortalApiApplication" Name="[SamplePortalApi][WEBSITE_ID]" WebAppPool="SamplePortalAppPool"></iis:WebApplication>
</iis:WebSite>
</Component>
</DirectoryRef>
<ComponentGroup Id="SamplePortalApiIisConfiguration">
<ComponentRef Id="InstallWebsite" />
<ComponentRef Id="SamplePortalAppPool" />
</ComponentGroup>
Database.wxs
<Binary Id="MigrationBin" SourceFile="Migration.sql"></Binary>
<Binary Id="CreateLoginBin" SourceFile="CreateLogin.sql"></Binary>
<Binary Id="CreateUserBin" SourceFile="CreateUser.sql"></Binary>
<Binary Id="DeleteLoginBin" SourceFile="DeleteLogin.sql"></Binary>
<DirectoryRef Id="INSTALLFOLDER">
<Component Id="SqlComponent" Guid="8A1C82DB-1DD3-4FB5-8600-4F370FE1E04B">
<Condition>NOT Installed</Condition>
<sql:SqlDatabase Id="SamplePortalApiDatabase" Database="[DB_DATABASE]" Server="[DB_SERVER]" CreateOnInstall="yes" DropOnUninstall="yes" ContinueOnError="no">
<sql:SqlScript Id="Migration" ExecuteOnInstall="yes" ExecuteOnUninstall="no" BinaryKey="MigrationBin" ContinueOnError="no" />
<sql:SqlScript Id="CreateLogin" ExecuteOnInstall="yes" ExecuteOnUninstall="no" BinaryKey="CreateLoginBin" ContinueOnError="no"/>
<sql:SqlScript Id="DeleteLogin" ExecuteOnInstall="no" ExecuteOnUninstall="yes" BinaryKey="DeleteLoginBin" ContinueOnError="no"/>
</sql:SqlDatabase>
<CreateFolder/>
</Component>
</DirectoryRef>
What's the best approach here? I think I could run the problematic SQL as a CustomAction rather than as part of the built in WXS functionality, but I don't think this is the most elegant approach. Is there a better way of ensuring that IIS is setup properly first?

32/64 bit WiX Combined Installer-Copying files only

I have an msi that copies files (PLC Code) to a directory(C:\Product\3.1\Boot), and modifies one key.
My visual studio project generates different PLC Code for the different architectures, but the destination is the same on both platforms. They key is in a different spot.
I have looked at using the arch-switch and conditional statements, but these look to only detect the architecture on which it is compiled, and not where the msi is run.
I know that you cant have 32/64 in the same MSI, but I'm not doing anything other than copying files and changing registries. I'm not putting anything in the windows directories/program files.
Though I would like it to appear with a version in the list of programs.
Is it possible in this case to have one installer?
Code
'''
<Product Id="*"
Name="Company"
Language="1033"
Version="4.09"
Manufacturer="CompanyInc."
UpgradeCode="YOUR_GUID"
>
<Package Id ="*"
InstallerVersion="200"
InstallPrivileges="elevated"
Compressed="yes"
InstallScope="perMachine"
Description="Company PLC Code"
Manufacturer="CompanyInc."
Keywords="PLC"
Comments="F"
/>
<!--Upgrade/install control-->
<MajorUpgrade
AllowDowngrades="yes"
/>
<!--GUI for install display-->
<UI>
<UIRef Id="WixUI_Minimal" /> <!--Define type of UI -->
</UI>
<Upgrade Id="GUID_HERE">
<UpgradeVersion OnlyDetect="no"
Property="SELFFOUND"
Minimum="1.0"
/>
</Upgrade>
<MediaTemplate EmbedCab="yes" />
<!-- Set the icon used in the programs and features list-->
<Icon Id='ProductIcon' SourceFile='Company.ico' />
<Property Id='ARPPRODUCTICON' Value='ProductIcon' />
<!-- Things to install-->
<Feature Id="Default" Title="PLC Code" Level="1">
<ComponentGroupRef Id="ProductComponentsx64" />
</Feature>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="Company PLC" />
<Directory Id="BOOTDIR" />
<Directory Id="PLCDIR" />
</Directory>
</Directory>
<SetDirectory Id="BOOTDIR" Value="C:\CompanySoftware\3.1\Boot" />
<SetDirectory Id="PLCDIR" Value="C:\CompanySoftware\3.1\Boot\Plc" />
<!--Specify when actions occur actions during install-->
<InstallExecuteSequence>
<Custom Action="ARCHIVEBOOTDIR" After ="CostFinalize" />
<!--ToDo: copy files-->
</InstallExecuteSequence>
</Product>
<Fragment>
<!--64 bit systems: Place files in appropriate directories and modify registry key for Company to autostart -->
<ComponentGroup Id="ProductComponentsx64">
<Component Id="BootComponents" Guid="" Directory="BOOTDIR">
<File Id="CurrentConfig.xml" Source="..\_Boot\CompanySoftware RT (x64)\CurrentConfig.xml" KeyPath="no" />
</Component>
<Component Id="PLCComponent" Guid="" Directory="PLCDIR">
<File Id="Port_851.app" Source="..\_Boot\CompanySoftware RT (x64)\Plc\Port_851.app" KeyPath="no" />
<File Id="Port_851.autostart" Source="..\_Boot\CompanySoftware RT (x64)\Plc\Port_851.autostart" KeyPath="no" />
<File Id="Port_851.cid" Source="..\_Boot\CompanySoftware RT (x64)\Plc\Port_851.cid" KeyPath="no" />
<File Id="Port_851.crc" Source="..\_Boot\CompanySoftware RT (x64)\Plc\Port_851.crc" KeyPath="no" />
<File Id="Port_851.occ" Source="..\_Boot\CompanySoftware RT (x64)\Plc\Port_851.occ" KeyPath="no" />
<File Id="Port_851.ocm" Source="..\_Boot\CompanySoftware RT (x64)\Plc\Port_851.ocm" KeyPath="no" />
<File Id="Port_851_boot.tizip" Source="..\_Boot\CompanySoftware RT (x64)\Plc\Port_851_boot.tizip" KeyPath="no" />
</Component>
<Component Id="StartupReg" Guid="" Directory="TARGETDIR">
<RegistryKey Root="HKLM"
Key="Software\WOW6432Node\Company\CompanySoftware3\System">
<RegistryValue Name="SysStartupState"
Type="integer"
Value ="5"/>
</RegistryKey>
</Component>
</ComponentGroup>
</Fragment>
<Fragment>
<!--32 bit systems: Place files in appropriate directories and modify registry key for Company to autostart -->
<ComponentGroup Id="ProductComponentsx86">
<Component Id="BootComponents" Guid="" Directory="BOOTDIR">
<File Id="CurrentConfig.xml" Source="..\_Boot\CompanySoftware RT (x86)\CurrentConfig.xml" KeyPath="no" />
<File Id="Company.ico" Source="Company.ico" KeyPath="no" />
</Component>
<Component Id="PLCComponent" Guid="" Directory="PLCDIR">
<File Id="Port_851.app" Source="..\_Boot\CompanySoftware RT (x86)\Plc\Port_851.app" KeyPath="no" />
<File Id="Port_851.autostart" Source="..\_Boot\CompanySoftware RT (x86)\Plc\Port_851.autostart" KeyPath="no" />
<File Id="Port_851.cid" Source="..\_Boot\CompanySoftware RT (x86)\Plc\Port_851.cid" KeyPath="no" />
<File Id="Port_851.crc" Source="..\_Boot\CompanySoftware RT (x86)\Plc\Port_851.crc" KeyPath="no" />
<File Id="Port_851.occ" Source="..\_Boot\CompanySoftware RT (x86)\Plc\Port_851.occ" KeyPath="no" />
<File Id="Port_851.ocm" Source="..\_Boot\CompanySoftware RT (x86)\Plc\Port_851.ocm" KeyPath="no" />
<File Id="Port_851_boot.tizip" Source="..\_Boot\CompanySoftware RT (x86)\Plc\Port_851_boot.tizip" KeyPath="no" />
</Component>
<Component Id="StartupReg" Guid="" Directory="TARGETDIR">
<RegistryKey Root="HKLM"
Key="Software\Company\CompanySoftware3\System">
<RegistryValue Name="SysStartupState"
Type="integer"
Value ="5"/>
</RegistryKey>
</Component>
</ComponentGroup>
</Fragment>
'''
I was able to figure out how to get this to work. By using the Condition and ![CDATA[NOT(VersionNT64)]] to detect the version I was able to perform different actions!
<Product Id="*"
Name="Company PLC"
Language="1033"
Version="4.09"
Manufacturer="Company Inc."
UpgradeCode="Code"
>
<Package Id ="*"
InstallerVersion="200"
InstallPrivileges="elevated"
Compressed="yes"
InstallScope="perMachine"
Description="Company CompanySoftware PLC Code"
Manufacturer="Company Inc."
Keywords="PLC"
Comments="Company "
/>
<!--Upgrade/install control-->
<MajorUpgrade
AllowDowngrades="yes"
/>
<!--GUI for install display-->
<!-- future use for custom graphics on the MSI pages
<WixVariable Id="WixUIBannerBmp" Value="CompanyWixUIBanner.bmp" />
<WixVariable Id="WixUIDialogBmp" Value="CompanyWixUIBanner.bmp" />
-->
<UI>
<UIRef Id="WixUI_Minimal" />
<!--Define type of UI -->
</UI>
<Upgrade Id="CODE">
<UpgradeVersion OnlyDetect="no"
Property="SELFFOUND"
Minimum="1.0"
/>
</Upgrade>
<MediaTemplate EmbedCab="yes" />
<!-- Set the icon used in the Windows programs and features list-->
<Icon Id='ProductIcon' SourceFile='Company.ico' />
<Property Id='ARPPRODUCTICON' Value='ProductIcon' />
<!-- Things to install- This would normally appear as the selectable list of items to install in a regular installer-->
<Feature Id="Default_x64" Title="PLC Code x64" Level="1">
<Condition Level ="1">
<![CDATA[(VersionNT64)]]>
</Condition>
<ComponentGroupRef Id="ProductComponentsx64" />
</Feature>
<Feature Id="Default_x86" Title="PLC Code x86" Level="1">
<Condition Level ="1">
<![CDATA[NOT(VersionNT64)]]>
</Condition>
<ComponentGroupRef Id="ProductComponentsx86" />
</Feature>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="Company PLC" />
<Directory Id="BOOTDIR" />
<Directory Id="PLCDIR" />
</Directory>
</Directory>
<SetDirectory Id="BOOTDIR" Value="C:\CompanySoftware\3.1\Boot" />
<SetDirectory Id="PLCDIR" Value="C:\CompanySoftware\3.1\Boot\Plc" />
</Product>
<Fragment>
<!--64 bit systems: Place files in appropriate directories and modify registry key for Company to autostart -->
<ComponentGroup Id="ProductComponentsx64">
<Component Id="BootComponentsx64" Guid="" Directory="BOOTDIR">
<Condition>
<![CDATA[(VersionNT64)]]>
</Condition>
<File Id="CurrentConfig.xml.x64" Source="..\_Boot\CompanySoftware RT (x64)\CurrentConfig.xml" KeyPath="no" />
</Component>
<Component Id="PLCComponent.x64" Guid="" Directory="PLCDIR">
<Condition>
<![CDATA[(VersionNT64)]]>
</Condition>
<File Id="Port_851.app.x64" Source="..\_Boot\CompanySoftware RT (x64)\Plc\Port_851.app" KeyPath="no" />
</Component>
<Component Id="StartupReg.x64" Guid="" Directory="TARGETDIR">
<Condition>
<![CDATA[(VersionNT64)]]>
</Condition>
<RegistryKey Root="HKLM"
Key="Software\WOW6432Node\Company\CompanySoftware\System">
<RegistryValue Name="SysStartupState"
Type="integer"
Value ="5"/>
</RegistryKey>
</Component>
</ComponentGroup>
</Fragment>
<Fragment>
<!--32 bit systems: Place files in appropriate directories and modify registry key for Company to autostart -->
<ComponentGroup Id="ProductComponentsx86">
<Component Id="BootComponentsx86" Guid="" Directory="BOOTDIR">
<Condition>
<![CDATA[NOT(VersionNT64)]]>
</Condition>
<File Id="CurrentConfig.xml.x86" Source="..\_Boot\CompanySoftware RT (x86)\CurrentConfig.xml" KeyPath="no" />
</Component>
<Component Id="PLCComponentx86" Guid="" Directory="PLCDIR">
<Condition>
<![CDATA[NOT(VersionNT64)]]>
</Condition>
<File Id="Port_851.app.x86" Source="..\_Boot\CompanySoftware RT (x86)\Plc\Port_851.app" KeyPath="no" />
</Component>
<Component Id="StartupReg.x86" Guid="" Directory="TARGETDIR">
<Condition>
<![CDATA[NOT(VersionNT64)]]>
</Condition>
<RegistryKey Root="HKLM"
Key="Software\Company\CompanySoftware\System">
<RegistryValue Name="SysStartupState"
Type="integer"
Value ="5"/>
</RegistryKey>
</Component>
</ComponentGroup>
</Fragment>

Creating a Virtual Directory on IIS using IsWix

I'm creating an IsWix solution that creates an IIS with a static javascript website.
The website is working as expected after the instalation when I enter to
localhost:8080
The problem starts here, I'm unable to serve this website on a virtual directory.
I want to be able to use localhost/myApp to browse the app.
In your main project under Code\IISMeta.wxs you'll find the markup that defines the IIS configuration. This file can express any valid WiX IIS meta as documented here:
https://wixtoolset.org/documentation/manual/v3/xsd/iis/
A basic example (needs some tweaking) would look something like this:
<Directory Id="webSites" Name="WebSites">
<Component Id="webSite" Guid="PUT_GUID_HERE" KeyPath="yes" Permanent="yes">
<CreateFolder />
<iis:WebSite Id="DefaultWebSite" SiteId="*" Description="Default Web Site" Directory="webSites" ConfigureIfExists="no" >
<iis:WebAddress Id="webSite" Port="80" />
<iis:WebDirProperties Id="webSite" AnonymousAccess="yes" WindowsAuthentication="no" />
</iis:WebSite>
</Component>
<Directory Id="webSiteUi" Name="UI">
<Component Id="webSiteUi" Guid="PUT GUID HERE" KeyPath="yes">
<iis:WebAppPool Id="webSiteUi" Name="WebSiteUI" Identity="networkService" ManagedRuntimeVersion="v4.0" ManagedPipelineMode="Classic" />
<iis:WebVirtualDir Id="webSiteUi" Alias="Something" Directory="webSiteUi" WebSite="DefaultWebSite">
<iis:WebDirProperties Id="webSiteUi" AnonymousAccess="yes" WindowsAuthentication="no" />
<iis:WebApplication Id="webSiteUi" WebAppPool="webSiteUi" Name="Something" />
</iis:WebVirtualDir>
</Component>
</Directory>

Can I allow a user to choose either applicationPoolIdentity or specify a user using WiX-IIS extension?

My web application typically will be installed to use applicationPoolIdentity:
<iis:WebAppPool Id="MyAppPool" Identity="applicationPoolIdentity" Name="MyAppPool"/>
but I have a class of users that will want to use a specific domain user instead, which I would typically author like this:
<util:User Id="MyUser" Name="[MY_USER]" Domain="[MY_DOMAIN]" Password="[MY_PASSWORD]" CreateUser="no"/>
<iis:WebAppPool Id="MyAppPool" Identity="other" User="MyUser" Name="MyAppPool" />
Making the user interface for this is simple enough, but is there a way to conditionally switch between Identity="applicationPoolIdentity" and Identity="other" without writing a custom action?
Yes, it is possible but you will need to create a component group with two components that have conditionals. As this solution is a bit verbose, I recommend having it in a separate file.
Here is an example, based on https://www.codeproject.com/Articles/115036/Creating-WIX-Installer-for-ASP-NET-Web-Application.
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:iis="http://schemas.microsoft.com/wix/IIsExtension"
xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
<Fragment>
<Property Id="IIS_WEBSITE" Value="root"/>
<Property Id="VIRTUAL_DIR_VAL" Value="myappdir" />
<!-- +++++++++++++++++++ web app name properties initialize ++++++++++++++++++++ -->
<Property Id="WEB_APP_NAME" Value="myapp" />
<Property Id="WEB_APP_USE_CUSTOM_APP_POOL_IDENTITY" Value="1" />
<!-- +++++++++++++++++++ app pool identity properties initialize +++++++++++++++ -->
<Property Id="WEB_APP_POOL_IDENTITY_DOMAIN" Value="domain" />
<Property Id="WEB_APP_POOL_IDENTITY_NAME" Value="user" />
<Property Id="WEB_APP_POOL_IDENTITY_PWD" Hidden="yes" />
<!-- Reference to IIS Website to install to, but not create -->
<iis:WebSite Id='rootwebsite'
Description='[IIS_WEBSITE]'
Directory='INSTALLFOLDER'>
<!-- This element has to be here or WiX does not compile. It’s ignored
in this case. -->
<iis:WebAddress Id="AllUnassignedHTTP" Port="80" />
<iis:WebAddress Id="AllUnassignedHTTPS" Port="443" />
</iis:WebSite>
<DirectoryRef Id="INSTALLFOLDER">
<Component Id="InstallWebsiteCustomUser" Guid="[guid]" KeyPath="yes" Win64="yes">
<Condition><![CDATA[WEB_APP_USE_CUSTOM_APP_POOL_IDENTITY = 1]]></Condition>
<util:User Id="WebAppPoolUser"
CreateUser="no"
Name="[WEB_APP_POOL_IDENTITY_NAME]"
Password="[WEB_APP_POOL_IDENTITY_PWD]"
Domain="[WEB_APP_POOL_IDENTITY_DOMAIN]" />
<iis:WebAppPool Id="WebAppPoolCustom"
Name="[WEB_APP_NAME]"
Identity="other"
User="WebAppPoolUser"
ManagedPipelineMode="Integrated"
ManagedRuntimeVersion="v4.0"
RecycleMinutes="200" />
<iis:WebVirtualDir Id="WebVirtualDirCustom"
Alias="[VIRTUAL_DIR_VAL]"
Directory="INSTALLFOLDER"
WebSite="rootwebsite">
<!-- Turn the Virtual Directory into a web application. -->
<iis:WebApplication Id="WebApplicationCustom"
Name="[WEB_APP_NAME]"
WebAppPool="WebAppPoolCustom" />
</iis:WebVirtualDir>
</Component>
<Component Id="InstallWebsite" Guid="[guid]" KeyPath="yes" Win64="yes">
<Condition><![CDATA[WEB_APP_USE_CUSTOM_APP_POOL_IDENTITY <> 1]]></Condition>
<iis:WebAppPool Id="WebAppPool"
Name="[WEB_APP_NAME]"
Identity="applicationPoolIdentity"
ManagedPipelineMode="Integrated"
ManagedRuntimeVersion="v4.0"
RecycleMinutes="200"/>
<iis:WebVirtualDir Id="WebVirtualDir"
Alias="[VIRTUAL_DIR_VAL]"
Directory="INSTALLFOLDER"
WebSite="rootwebsite">
<!-- Turn the Virtual Directory into a web application. -->
<iis:WebApplication Id="WebApplication"
Name="[WEB_APP_NAME]"
WebAppPool="WebAppPool" />
</iis:WebVirtualDir>
</Component>
</DirectoryRef>
<ComponentGroup Id="IisConfiguration">
<ComponentRef Id="InstallWebsiteCustomUser" />
<ComponentRef Id="InstallWebsite" />
</ComponentGroup>
</Fragment>
</Wix>

Wix installer: Verify that you have sufficient privileges to start system services

I'm using Wix installer. When I run installer I get this error:
I'm logged as administrator. I also tried create anotherone user.
So I tried:
1| I add my user "Administrator" to place "Log on as a service"
2| I checked my Net.Tcp Port Sharing Service if is running
3| I get my SID
4| I added to SMSvcHost.exe.config section with my SID.
Check "My administrator sid"
<system.serviceModel.activation>
<net.tcp listenBacklog="10" maxPendingConnections="100" maxPendingAccepts="2" receiveTimeout="00:00:10" teredoEnabled="false">
<allowAccounts>
// My administrator sid
<add securityIdentifier="S-1-5-21-334175509-2570308825-1313804348-500"/>
// LocalSystem account
<add securityIdentifier="S-1-5-18"/>
// LocalService account
<add securityIdentifier="S-1-5-19"/>
// Administrators account
<add securityIdentifier="S-1-5-20"/>
// Network Service account
<add securityIdentifier="S-1-5-32-544" />
// IIS_IUSRS account (Vista only)
<add securityIdentifier="S-1-5-32-568"/>
</allowAccounts>
</net.tcp>
<net.pipe maxPendingConnections="100" maxPendingAccepts="2" receiveTimeout="00:00:10">
<allowAccounts>
// LocalSystem account
<add securityIdentifier="S-1-5-18"/>
// LocalService account
<add securityIdentifier="S-1-5-19"/>
// Administrators account
<add securityIdentifier="S-1-5-20"/>
// Network Service account
<add securityIdentifier="S-1-5-32-544" />
// IIS_IUSRS account (Vista only)
<add securityIdentifier="S-1-5-32-568"/>
</allowAccounts>
</net.pipe>
<diagnostics performanceCountersEnabled="true" />
</system.serviceModel.activation>
5| I edit all SMSvcHost.exe.config for sure:
C:\Windows\Microsoft.NET\Framework\v3.0\Windows Communication Foundation\
C:\Windows\Microsoft.NET\Framework\v4.0.30319
C:\Windows\Microsoft.NET\Framework64\v3.0\Windows Communication Foundation
C:\Windows\Microsoft.NET\Framework64\v4.0.30319
6| Restart = Net.Tcp Port Sharing Service
7| When I got that warning message during instalation, I didn't cancel, I tried also run service from path where files are installed and via cmd prompt I run manualy and it's run.
8| But my instalator can't finish instalation. Everytime I got that sentense: "Verify that you have sufficient privileges to start system services." I can only cancel instalation and instalation roll back and delete all files.
ANY HELP PLEASE? 5 DAYS I'M GOING AROUND THIS WITHOUT RESULT. I TESTED THAT ON 2 DIFERRENT VIRTUAL MACHINES WITH WINDOWS SERVER X64 AND WINDOWS 8 X64.
My component code is here:
<?xml version="1.0" encoding="utf-8"?>
<!--
"C:\Program Files (x86)\Windows Installer XML v3.6\bin\heat.exe" dir ..\WindowsServiceHost\bin\Release -dr TARGETDIR -cg WindowsServiceHost_Project -scom -sfrag -sreg -srd -gg -var var.WindowsServiceHost.TargetDir -out WindowsServiceHost.wxs -pog Binaries -pog Content
-->
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
<!-- The initially, this has been created with Heat to get all output -->
<Fragment>
<DirectoryRef Id="APPLICATIONFOLDER">
<Component Id="cmpF563E3CE297225623330C6BDFBFCDB12" Guid="{6742348C-A620-46FA-8DA8-0EB0CCA1C123}">
<File Id="fil21CA92101BF52AFED2FDCE521FCA6123" KeyPath="yes" Source="$(var.WindowsServiceHost.TargetDir)\Antlr3.Runtime.dll" />
</Component>
<Component Id="cmp353671C776668DEF5DCC15C233E2CA49" Guid="{A8F26FCD-4BBB-4665-903A-45DDAAFE3123}">
<File Id="fil889A0DB56C827E66FA3035CED6E3E123" KeyPath="yes" Source="$(var.WindowsServiceHost.TargetDir)\Castle.ActiveRecord.dll" />
</Component>
<Component Id="cmpCD33B68B2028B11161C5509206174D37" Guid="{248DAA3F-EC3C-44E5-A57A-DD7090222123}">
<File Id="fil98E1300420674E5F83417696A895A123" KeyPath="yes" Source="$(var.WindowsServiceHost.TargetDir)\Castle.Components.Validator.dll" />
</Component>
<Component Id="cmp4AE2CD167FF4894E9076AF5FC612D123" Guid="{D7BB86D2-A384-4AAE-8D52-B0877B849123}">
<File Id="fil808D19806529ABA1617D818072819123" KeyPath="yes" Source="$(var.WindowsServiceHost.TargetDir)\Castle.Core.dll" />
</Component>
<Component Id="cmpD9F8C495CF8479B78BC318E8E9DAA123" Guid="{DA1C4B1F-FE3C-42D2-A273-39BFB2FB7123}">
<File Id="fil2EBE8BAEA1EB66844366CCC4FD863123" KeyPath="yes" Source="$(var.WindowsServiceHost.TargetDir)\Castle.Facilities.WcfIntegration.dll" />
</Component>
<Component Id="cmp3F6A205A397BEA19BBA40D18483BD123" Guid="{2FDB99B1-D558-4750-A3DB-00D8EB1C1123}">
<File Id="fil151C8FBAEDA5D4BDEB438F301EAE7123" KeyPath="yes" Source="$(var.WindowsServiceHost.TargetDir)\Castle.Windsor.dll" />
</Component>
<Component Id="cmpC070BF8C300741A523BD7ED7CBB9C123" Guid="{71DDC933-8912-4CEB-9257-FE07A0A3C123}">
<File Id="filD577F4DF6A5A8E2CC82379AC96025123" KeyPath="yes" Source="$(var.WindowsServiceHost.TargetDir)\Viewer.Viewer.DAL.dll" />
</Component>
<Component Id="cmp38F30287B63682CF5E25FFED1C597123" Guid="{896B54CA-6279-48A2-A20D-6C32D9370123}">
<File Id="fil2E5F30135D3485052620C0369A0C8123" KeyPath="yes" Source="$(var.WindowsServiceHost.TargetDir)\Viewer.Viewer.exe" />
<!-- This is the problem I was having - I was not able to reference this component and this is not supported yes as based on hours of googling -->
<!-- We're able to define almost anything on how the service is configured, under which user, etc -->
<ServiceInstall Id="ServiceInstaller" Type="ownProcess" Vital="yes" Name="ViewerService"
DisplayName="Viewer Service" Description="Viewer service handles all user requests and manages tasks."
Start="auto" Account="[SERVICEACCOUNT]" Password="[SERVICEPASSWORD]" ErrorControl="ignore" Interactive="no">
<util:ServiceConfig FirstFailureActionType="restart" SecondFailureActionType="restart" ThirdFailureActionType="restart" />
</ServiceInstall>
<ServiceControl Id="StartService" Start="install" Stop="both" Remove="uninstall" Name="ViewerService" Wait="yes" />
</Component>
<Component Id="cmpF4715A23C1FF23A034E3C5D7E9899123" Guid="{5439277D-DA70-476D-AFA3-A7E21792B123}">
<File Id="filD6D2807DE16A409F1A2667BA03ED8123" KeyPath="yes" Source="$(var.WindowsServiceHost.TargetDir)\Viewer.exe.config" />
</Component>
<Component Id="cmpED6174C35AEBF8A8918AC859C9681123" Guid="{84A5A3C2-A5DE-40AB-8ADC-31D2A5C1E123}">
<File Id="fil5DD49061C2ED546B40CEED5FC1BD2123" KeyPath="yes" Source="$(var.WindowsServiceHost.TargetDir)\Viewer.Library.dll" />
</Component>
<Component Id="cmpB2A2EA83D72F4C7290397730910A4123" Guid="{6A8F8C8A-47E7-4A70-B05C-92EA6711B123}">
<File Id="filF3891F073E13532E343276EC37F96123" KeyPath="yes" Source="$(var.WindowsServiceHost.TargetDir)\PstLibrary.dll" />
</Component>
<Component Id="cmpEBE3708427CCDA04E12DE366A56F4123" Guid="{60645E54-C07B-41B3-B219-4B7CECC5A123}">
<File Id="fil06760C8D25183C8A8CF53F339D6BC123" KeyPath="yes" Source="$(var.WindowsServiceHost.TargetDir)\Iesi.Collections.dll" />
</Component>
<Component Id="cmp2B6E39BC25CC0CDCEC3DAC9E80C14123" Guid="{6728EDE3-FCCD-4FC1-9032-2EA6F84E7123}">
<File Id="fil3CA8B6115A016E51F3BA10386CAEE123" KeyPath="yes" Source="$(var.WindowsServiceHost.TargetDir)\Ionic.Zip.Reduced.dll" />
</Component>
<Component Id="cmp95FFFFB1FF4FE88C7ABFAFDC94AFA123" Guid="{354B5354-4134-4225-9FA8-B6EBD1566123}">
<File Id="filD2AD4A87E4FFD97570BD414BF64D2123" KeyPath="yes" Source="$(var.WindowsServiceHost.TargetDir)\LogModule.dll" />
</Component>
<Component Id="cmp06CFD0EF8C78731C8FE99058BA827123" Guid="{13D3CCD4-A068-40F7-91F7-01BD9DAC7123}">
<File Id="filC52F7EC41731AA5B6D39C500DF546123" KeyPath="yes" Source="$(var.WindowsServiceHost.TargetDir)\Lucene.Net.dll" />
</Component>
<Component Id="cmp02134B521CDB778B256053B705B39123" Guid="{AB850CDB-C591-47C4-876A-00744AFAC123}">
<File Id="fil8B09A9C2BC8D71A0E5E923F6F4039123" KeyPath="yes" Source="$(var.WindowsServiceHost.TargetDir)\MailBee.NET.dll" />
</Component>
<Component Id="cmp0732D020141A27B3EF606680AF63C123" Guid="{39446EE7-47AE-4757-B5A4-DED57F7CE123}">
<File Id="fil194D74862CE83A0371D6324FE1C0D123" KeyPath="yes" Source="..\_dependencies\Interop.Redemption.dll" />
</Component>
<Component Id="cmp0732D020141A27B3EF606680AF632123" Guid="{39446EE7-47AE-4757-B5A4-DED57F7C2123}">
<File Id="fil194D74862CE83A0371D6324FE1C02123" KeyPath="yes" Source="..\_dependencies\Redemption64.dll" />
</Component>
<Component Id="cmp9D56D720C5BABC0701758947084E5123" Guid="{E5C9921B-AA90-4B88-898F-5A3C6D2F7123}">
<File Id="filFEE1876E7EF6CE4F720645154DFD8123" KeyPath="yes" Source="$(var.WindowsServiceHost.TargetDir)\NHibernate.ByteCode.Castle.dll" />
</Component>
<Component Id="cmp48A389F21271FDC5825A9C1B25E82123" Guid="{D485D984-1568-4A28-B2EC-EFE9791B7123}">
<File Id="fil6EDFA9A322A7AB6A8E262D0DB4F60123" KeyPath="yes" Source="$(var.WindowsServiceHost.TargetDir)\NHibernate.dll" />
</Component>
<Component Id="cmpFEBBE1308148FADB702D2C8F4D13E123" Guid="{725DD9FB-61EC-48F8-A988-916C30C73123}">
<File Id="fil5145831B362C7509226E3A90E8FF2123" KeyPath="yes" Source="$(var.WindowsServiceHost.TargetDir)\NHibernate.Search.dll" />
</Component>
<Component Id="cmpEED54193D815302FC314DB0A2C9F8123" Guid="{DD277B4A-63F4-4988-BA83-D9AF1FC89123}">
<File Id="filF81E55DF73063A3872976B67B6628123" KeyPath="yes" Source="$(var.WindowsServiceHost.TargetDir)\Library.dll" />
</Component>
<Component Id="cmpA42846C9FB9AE5A84F07BCD1C1077123" Guid="{7A89E8A4-D5DC-4EB2-A80B-BB3455B2F123}">
<File Id="fil10DFB7AB70BD839083EA5F5DCA22C123" KeyPath="yes" Source="$(var.WindowsServiceHost.TargetDir)\Processing.dll" />
</Component>
<Component Id="cmpE88CBB7A43EF8781FD98762843CF1123" Guid="{862E6578-5507-4128-89CA-877315A88123}">
<File Id="fil6095C78A39C6633B24FADCC044720123" KeyPath="yes" Source="$(var.WindowsServiceHost.TargetDir)\RedemptionWrapper.dll" />
</Component>
<Component Id="cmp74BE405C599A7B2BFF4B24B035404123" Guid="{65632DE4-45A3-4C81-911F-8E0EA7073123}">
<File Id="fil9FAD52E634F2925DB072CBBAE8AC5123" KeyPath="yes" Source="$(var.WindowsServiceHost.TargetDir)\Remotion.Data.Linq.dll" />
</Component>
<Directory Id="dirD9D25461613D53ECC73127337CA03123" Name="Licenses">
<Component Id="cmpC47DFFE5D48426458E24BE6D0A83C123" Guid="{4F3CFB3D-4E7A-4430-8EC6-3403EB856123}">
<File Id="filF3CFC81B4D04F6521220038AE4103123" KeyPath="yes" Source="..\Common\Licenses\Antlr3.license.txt" />
</Component>
<Component Id="cmp322E81F6D6B5D7FFE823EAEABAE77123" Guid="{E48BC22E-682C-4D87-BABF-1E71F6AE2123}">
<File Id="fil7294E69E9C2DDF5F09B62BA6E2EB1123" KeyPath="yes" Source="..\Common\Licenses\Castle.license.txt" />
</Component>
<Component Id="cmp5537750B07AA6621D099EA533E58C123" Guid="{412C1F3B-1A6C-444F-8645-4503F484F123}">
<File Id="filFFF3C0457CC60E6EC076FBB3DD232123" KeyPath="yes" Source="..\Common\Licenses\Iesi.Collections.license.txt" />
</Component>
<Component Id="cmp92EF42C91FD5F2D0797844A57BE78123" Guid="{E35E3446-8DD2-4DE0-B7FE-E27556D8D123}">
<File Id="filA9F4D112BA2C37F6067E328E8C972123" KeyPath="yes" Source="..\Common\Licenses\Ionic.Zip.license.txt" />
</Component>
<Component Id="cmpD6E1D6312AA116069E68B968F9AED123" Guid="{B670C6F0-901F-4049-A256-406B77F0E123}">
<File Id="filC50888C92A23713C5CE5FA816A8F9123" KeyPath="yes" Source="..\Common\Licenses\Lucene.Net.license.txt" />
</Component>
<Component Id="cmp1EEBF5BABE23C2C767438072E6410123" Guid="{3799AA4F-A169-41A1-A1DE-907F315E3123}">
<File Id="filE39771746641899F88B2A3B05E9AA123" KeyPath="yes" Source="..\Common\Licenses\NHibernate.license.txt" />
</Component>
<Component Id="cmpCF5ECE8D2EADADA313278BA15AF99123" Guid="{94C3D676-8B2B-4AAE-A4BC-226763BEE123}">
<File Id="filC1AA47E8984A0651CDA4689D2A768123" KeyPath="yes" Source="..\Common\Licenses\NLog.license.txt" />
</Component>
<Component Id="cmp599BAD3717C0FCEE410496C8E8066123" Guid="{CF247694-83FE-456D-8645-55EDF88AD123}">
<File Id="filF046615251B088B6CBFB5383F775F123" KeyPath="yes" Source="..\Common\Licenses\Remotion.Data.Linq.license.txt" />
</Component>
</Directory>
</DirectoryRef>
</Fragment>
<Fragment>
<ComponentGroup Id="WindowsServiceHost_Project">
<ComponentRef Id="cmpF563E3CE297225623330C6BDFBFCD123" />
<ComponentRef Id="cmp353671C776668DEF5DCC15C233E2C123" />
<ComponentRef Id="cmpCD33B68B2028B11161C5509206174123" />
<ComponentRef Id="cmp4AE2CD167FF4894E9076AF5FC612D123" />
<ComponentRef Id="cmpD9F8C495CF8479B78BC318E8E9DAA123" />
<ComponentRef Id="cmp3F6A205A397BEA19BBA40D18483BD123" />
<ComponentRef Id="cmpC070BF8C300741A523BD7ED7CBB9C123" />
<ComponentRef Id="cmp38F30287B63682CF5E25FFED1C597123" />
<ComponentRef Id="cmpF4715A23C1FF23A034E3C5D7E9899123" />
<ComponentRef Id="cmpED6174C35AEBF8A8918AC859C9681123" />
<ComponentRef Id="cmpB2A2EA83D72F4C7290397730910A4123" />
<ComponentRef Id="cmpEBE3708427CCDA04E12DE366A56F4123" />
<ComponentRef Id="cmp2B6E39BC25CC0CDCEC3DAC9E80C14123" />
<ComponentRef Id="cmp95FFFFB1FF4FE88C7ABFAFDC94AFA123" />
<ComponentRef Id="cmp06CFD0EF8C78731C8FE99058BA827123" />
<ComponentRef Id="cmp02134B521CDB778B256053B705B39123" />
<ComponentRef Id="cmp9D56D720C5BABC0701758947084E5123" />
<ComponentRef Id="cmp48A389F21271FDC5825A9C1B25E82123" />
<ComponentRef Id="cmpFEBBE1308148FADB702D2C8F4D13E123" />
<ComponentRef Id="cmpEED54193D815302FC314DB0A2C9F8123" />
<ComponentRef Id="cmp74BE405C599A7B2BFF4B24B035404123" />
<ComponentRef Id="cmpC47DFFE5D48426458E24BE6D0A83C123" />
<ComponentRef Id="cmp322E81F6D6B5D7FFE823EAEABAE77123" />
<ComponentRef Id="cmp5537750B07AA6621D099EA533E58C123" />
<ComponentRef Id="cmp92EF42C91FD5F2D0797844A57BE78123" />
<ComponentRef Id="cmpD6E1D6312AA116069E68B968F9AED123" />
<ComponentRef Id="cmp1EEBF5BABE23C2C767438072E6410123" />
<ComponentRef Id="cmpCF5ECE8D2EADADA313278BA15AF99123" />
<ComponentRef Id="cmp599BAD3717C0FCEE410496C8E8066123" />
<ComponentRef Id="cmp0732D020141A27B3EF606680AF63C123" />
<ComponentRef Id="cmpA42846C9FB9AE5A84F07BCD1C1077123" />
<ComponentRef Id="cmpE88CBB7A43EF8781FD98762843CF1123" />
<ComponentRef Id="cmp0732D020141A27B3EF606680AF632123" />
</ComponentGroup>
</Fragment>
</Wix>
just fix the same problem by seperating the service control. do this
<ServiceControl Id="scStorageServiceReporter_Start"
Name="Dhcp"
Start="install"
Wait="no" />
<ServiceControl Id="scStorageServiceReporter_Stop"
Name="Dhcp"
Stop="uninstall"
Remove="uninstall"
Wait="yes" />
instead of this
<ServiceControl
Id="scStorageReporter"
Name="StorageReporterService"
Start="install"
Stop="both"
Remove="uninstall"
Wait="yes"/>
Looking at your snippet this may be a red herring, but I've seen this exact same error if your installer is also adding items to the GAC (which yours doesn't seem to be - hence the red herring). This is due to GAC'd components not being available until after the service control attempts to start the service. In this case the "permissions" message isn't accurate either!
You can try to rebuild the wix project. I got this issue too and rebuilding the project has fixed it.
In my particular case the problem was that the configuration *.config file that is used by my windows service was invalid, because of that the service could not be started. It took me a while to figure out what the problem was.
Maybe it will help someone.
You can get this error also because the application that starts running is throwing an exception soon after start. For example I got this error because I had Console.ReadKey in my code.
The best way to check if this is the case is to check your application logs. By default Windows Event Viewer won't have any helpful information.