使用MSI / WIX 3.5发出数据库权限问题

时间:2010-08-31 02:11:53

标签: sql-server security permissions wix

我已经创建了一个WIX数据库安装程序。它可以在我的DEV机器上使用SQLEXPRESS,但不能在我的测试机上使用(本地)。我使用Orca确认服务器在每种情况下都是正确的。以下几乎是我正在使用的,只有几个脚本。已知脚本工作正常,如果我完全取出它,它仍然会失败。

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi' 
     xmlns:util='http://schemas.microsoft.com/wix/UtilExtension' 
     xmlns:sql='http://schemas.microsoft.com/wix/SqlExtension'>

  <?include $(sys.CURRENTDIR)\Config.wxi?>
  <?include ..\Common.wxi?>

  <Product Name='Agent Desktop $(var.SVCNAME)-$(var.ProductVersion)-$(var.BranchName)' Id='*' UpgradeCode='$(var.UpgradeCode)'
    Language='1033' Codepage='1252' Version='$(var.ProductVersion)' Manufacturer='$(var.ProductManufacturer)'>

    <Package Id='*'
             Keywords='Installer'
             Description="$(var.ProductManufacturer) $(var.SVCNAME)-$(var.ProductVersion)-$(var.BranchName) Installer"
             Comments='Premier Contact Point and PCP are registered trademarks of $(var.ProductManufacturer)'
             Manufacturer='$(var.ProductManufacturer)'
             InstallerVersion='100'
             Languages='1033'
             Compressed='yes'
             SummaryCodepage='1252' />

    <Upgrade Id="$(var.UpgradeCode)">
      <UpgradeVersion
          Minimum="1.0.0.0" Maximum="99.0.0.0"
          Property="PREVIOUSVERSIONSINSTALLED"
          IncludeMinimum="yes" IncludeMaximum="no" />

    </Upgrade>
    <InstallExecuteSequence>
      <RemoveExistingProducts Before="InstallInitialize" />
    </InstallExecuteSequence>


    <Media Id='1' Cabinet='Sample.cab' EmbedCab='yes' DiskPrompt="CD-ROM #1" />
    <Property Id='DiskPrompt' Value="Premier Contact Point $(var.DBNAME)-$(var.ProductVersion)-$(var.BranchName) Installer [1]" />

        <Directory Id="TARGETDIR" Name="SourceDir">
            <Directory Id="ProgramFilesFolder">
        <Directory Id="PremierTechnologies" Name="$(var.ProductManufacturer)">
                  <Directory Id="INSTALLLOCATION" Name="PCP $(var.DBNAME)-$(var.ProductVersion)-$(var.BranchName)">

            <Component Id='SqlComponent' Guid='YOUR-GUID-HERE'>
              <sql:SqlDatabase Id='SqlDatabase' Database='$(var.DBNAME)-$(var.ProductVersion)-$(var.BranchName)' 
                               Server='$(var.DbServer)' CreateOnInstall='yes' DropOnUninstall='yes' ConfirmOverwrite='no' ContinueOnError='no'>

                <sql:SqlScript Id='Script0001' Sequence='01' BinaryKey='Script0001' ExecuteOnInstall='yes' />

              </sql:SqlDatabase>

            </Component>
          </Directory>

        </Directory>
            </Directory>
        </Directory>

    <Binary Id='Script0001' SourceFile='../../DatabaseUpdater/UpgradeScripts/Script0001.sql' />

    <Feature Id='SqlFeature' Title='SqlFeature' Level="1">
      <ComponentRef Id='SqlComponent' />
    </Feature>

  </Product>
</Wix>

使用(本地)/ SQLEXPRESS在本地计算机上安装OK,但是当我尝试使用'。'将其安装到SQL std计算机时。或者“(本地)”,使用Windows身份验证,我收到了可怕的Error 26201. failed to create SQL database错误。

我从PowerShell脚本中调用了MSI,如下所示:

start-process "msiexec.exe" "/i Database.msi /l*v Database-install.log" -wait

在日志文件中,我收到了以下错误详细信息。 (我读到'值3'行两侧的几行上下文通常足以诊断错误,但我看不到它的解决方案):

MSI (s) (E4:70) [11:54:27:897]: Note: 1: 1402 2: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Installer\Rollback\Scripts 3: 2 
MSI (s) (E4:70) [11:54:27:897]: Executing op: Header(Signature=1397708873,Version=405,Timestamp=1025466054,LangId=1033,Platform=0,ScriptType=1,ScriptMajorVersion=21,ScriptMinorVersion=4,ScriptAttributes=0)
MSI (s) (E4:70) [11:54:27:897]: Executing op: ProductInfo(ProductKey={59CBDFC0-F16D-492D-A46B-336421D7F2F2},ProductName=Agent Desktop DB-3.9.9.0-wix,PackageName=Database.msi,Language=1033,Version=50921481,Assignment=0,ObsoleteArg=0,,,PackageCode={A3E3E186-D9AF-46B9-90D8-8FB6217AC71F},,,InstanceType=0,LUASetting=0,RemoteURTInstalls=0,ProductDeploymentFlags=3)
MSI (s) (E4:70) [11:54:27:897]: SHELL32::SHGetFolderPath returned: C:\Documents and Settings\andrewm.PCPDEV\Application Data
MSI (s) (E4:70) [11:54:27:897]: Executing op: DialogInfo(Type=0,Argument=1033)
MSI (s) (E4:70) [11:54:27:897]: Executing op: DialogInfo(Type=1,Argument=Agent Desktop DB-3.9.9.0-wix)
MSI (s) (E4:70) [11:54:27:897]: Executing op: RollbackInfo(,RollbackAction=Rollback,RollbackDescription=Rolling back action:,RollbackTemplate=[1],CleanupAction=RollbackCleanup,CleanupDescription=Removing backup files,CleanupTemplate=File: [1])
MSI (s) (E4:70) [11:54:27:897]: Executing op: SetBaseline(Baseline=0,)
MSI (s) (E4:70) [11:54:27:897]: Executing op: SetBaseline(Baseline=1,)
MSI (s) (E4:70) [11:54:27:897]: Executing op: ActionStart(Name=ProcessComponents,Description=Updating component registration,)
MSI (s) (E4:70) [11:54:27:897]: Executing op: ProgressTotal(Total=1,Type=1,ByteEquivalent=24000)
MSI (s) (E4:70) [11:54:27:897]: Executing op: ComponentRegister(ComponentId={A53B47BD-FFCD-4A7B-BF6D-E5356B0AD76A},KeyPath=C:\Program Files\Premier Technologies\PCP AgentDesktop-3.9.9.0-wix\,State=3,,Disk=1,SharedDllRefCount=0,BinaryType=0)
MSI (s) (E4:70) [11:54:27:913]: Executing op: ActionStart(Name=InstallFiles,Description=Copying new files,Template=File: [1],  Directory: [9],  Size: [6])
MSI (s) (E4:70) [11:54:27:913]: Executing op: InstallProtectedFiles(AllowUI=1)
MSI (s) (E4:70) [11:54:27:913]: Executing op: ActionStart(Name=CreateDatabase,Description=Creating Databases,)
MSI (s) (E4:70) [11:54:27:913]: Executing op: CustomActionSchedule(Action=CreateDatabase,ActionType=25601,Source=BinaryData,Target=**********,CustomActionData=**********)
MSI (s) (E4:60) [11:54:27:913]: Invoking remote custom action. DLL: C:\WINDOWS\Installer\MSID7.tmp, Entrypoint: CreateDatabase
CreateDatabase:  Error 0x80004005: failed to create to database: 'AgentDesktop-3.9.9.0-wix', error: unknown error
MSI (c) (CC:08) [11:54:44:584]: Font created.  Charset: Req=0, Ret=0, Font: Req=MS Shell Dlg, Ret=MS Shell Dlg

Error 26201. Error -2147467259: failed to create SQL database: AgentDesktop-3.9.9.0-wix, error detail: unknown error.
MSI (s) (E4!6C) [11:54:46:444]: Product: Agent Desktop DB-3.9.9.0-wix -- Error 26201. Error -2147467259: failed to create SQL database: AgentDesktop-3.9.9.0-wix, error detail: unknown error.

Action ended 11:54:46: InstallFinalize. Return value 3.
MSI (s) (E4:70) [11:54:46:459]: User policy value 'DisableRollback' is 0
MSI (s) (E4:70) [11:54:46:459]: Machine policy value 'DisableRollback' is 0
MSI (s) (E4:70) [11:54:46:475]: Executing op: Header(Signature=1397708873,Version=405,Timestamp=1025466062,LangId=1033,Platform=0,ScriptType=2,ScriptMajorVersion=21,ScriptMinorVersion=4,ScriptAttributes=0)
MSI (s) (E4:70) [11:54:46:475]: Executing op: DialogInfo(Type=0,Argument=1033)
MSI (s) (E4:70) [11:54:46:475]: Executing op: DialogInfo(Type=1,Argument=Agent Desktop DB-3.9.9.0-wix)
MSI (s) (E4:70) [11:54:46:475]: Executing op: RollbackInfo(,RollbackAction=Rollback,RollbackDescription=Rolling back action:,RollbackTemplate=[1],CleanupAction=RollbackCleanup,CleanupDescription=Removing backup files,CleanupTemplate=File: [1])
MSI (s) (E4:70) [11:54:46:475]: Executing op: ActionStart(Name=CreateDatabase,Description=Creating Databases,)
MSI (s) (E4:70) [11:54:46:475]: Executing op: ProductInfo(ProductKey={59CBDFC0-F16D-492D-A46B-336421D7F2F2},ProductName=Agent Desktop DB-3.9.9.0-wix,PackageName=Database.msi,Language=1033,Version=50921481,Assignment=0,ObsoleteArg=0,,,PackageCode={A3E3E186-D9AF-46B9-90D8-8FB6217AC71F},,,InstanceType=0,LUASetting=0,RemoteURTInstalls=0,ProductDeploymentFlags=3)
MSI (s) (E4:70) [11:54:46:491]: SHELL32::SHGetFolderPath returned: C:\Documents and Settings\andrewm.PCPDEV\Application Data
MSI (s) (E4:70) [11:54:46:491]: Executing op: ActionStart(Name=InstallFiles,Description=Copying new files,Template=File: [1],  Directory: [9],  Size: [6])
MSI (s) (E4:70) [11:54:46:491]: Executing op: ActionStart(Name=ProcessComponents,Description=Updating component registration,)
MSI (s) (E4:70) [11:54:46:491]: Executing op: ComponentUnregister(ComponentId={A53B47BD-FFCD-4A7B-BF6D-E5356B0AD76A},ProductKey={59CBDFC0-F16D-492D-A46B-336421D7F2F2},BinaryType=0,)
MSI (s) (E4:70) [11:54:46:491]: Executing op: End(Checksum=0,ProgressTotalHDWord=0,ProgressTotalLDWord=0)
MSI (s) (E4:70) [11:54:46:491]: Error in rollback skipped.  Return: 5
MSI (s) (E4:70) [11:54:46:491]: No System Restore sequence number for this installation.
MSI (s) (E4:70) [11:54:46:491]: Unlocking Server
MSI (s) (E4:70) [11:54:46:491]: PROPERTY CHANGE: Deleting UpdateStarted property. Its current value is '1'.
Action ended 11:54:46: INSTALL. Return value 3.
Property(S): DiskPrompt = Premier Contact Point AgentDesktop-3.9.9.0-wix Installer [1]
Property(S): UpgradeCode = {79DB4D69-D287-4441-8148-40E270729E21}
Property(S): CreateDatabase = SqlDatabase?.??AgentDesktop-3.9.9.0-wix?3?1???0?0
Property(S): ExecuteSqlStrings = SqlDatabase?.??AgentDesktop-3.9.9.0-wix?3?1???Script0001?1?create table dbo.SchemaVersions 

我已经尝试了我能想到的一切,或者在WIX论坛(和这里)中提到的但是没有任何作用。我认为该错误确实是一个权限问题,但我正在使用的帐户在我尝试安装到的数据库中具有sysadmin权限。

您能想到或者您是否听说过WIX中的SqlDatabase安装程序CA会像这样失败的任何其他方式?

1 个答案:

答案 0 :(得分:2)

我发现调试这些问题的最佳方法是在有问题的数据库服务器上设置SQL事件探查器,并在那里查看详细的错误消息。每次都指出我做错了什么。 :)