2

質問:

Visual Studio 2012 と InstallShield を使用して Windows サービスのインストーラーを作成しました。

サービスは正常に実行されます。
インストーラーは、私の開発マシン (Windows 8 64 ビット) と XP 仮想マシン (32 ビット) で正常に動作します。

しかし、Windows Server 2008 R2 では、同じインストーラーが「エラー 10001」を受け取ります。
それ以上の情報はありません。

次の情報がイベント ログに含まれていました。

Product: DbBackupServiceSetup -- Error 1001. 
(NULL)
(NULL)
(NULL)
(NULL)
(NULL)

the message resource is present but the message is not found in the string/message table

手動でインストールする場合:

C:\Windows\Microsoft.NET\Framework64\v2.0.50727\InstallUtil.exe "D:\Program Files\Test\DbBackupService.exe"

その後、Windows Server 2008 R2 でも正常に動作します...

32 ビットの実行可能ファイルを含むインストーラーと 64 ビットの実行可能ファイルを含むインストーラーを作成しましたが、両方でこのエラーが発生します...

ロギングを有効にして msi を実行してみました

msiexec /i "D:\Install\DISK1\DbBackupServiceSetup.msi" /Lv "D:\example.log"

ログファイルのエラーの最初の兆候は次のとおりです。

Created Custom Action Server with PID 3932 (0xF5C).
MSI (s) (C0:74) [14:26:28:065]: Running as a service.
MSI (s) (C0:74) [14:26:28:080]: Hello, I'm your 32bit Elevated custom action server.
MSI (s) (C0!14) [14:26:33:681]: 
MSI (s) (C0:E8) [14:26:33:681]: Leaked MSIHANDLE (16) of type 790531 for thread 3348
MSI (s) (C0:E8) [14:26:33:681]: Note: 1: 2769 2: _B384C869AD7BC0C39F5780609620645B.install 3: 1 
Info 2769. Custom Action _B384C869AD7BC0C39F5780609620645B.install did not close 1 MSIHANDLEs.
CustomAction _B384C869AD7BC0C39F5780609620645B.install returned actual error code 1603 (note this may not be 100% accurate if translation happened inside sandbox)
Action ended 14:26:33: InstallFinalize. Return value 3.
MSI (s) (C0:F0) [14:26:33:697]: User policy value 'DisableRollback' is 0
MSI (s) (C0:F0) [14:26:33:697]: Machine policy value 'DisableRollback' is 0

理解できません。
まったく同じインストーラーが他のマシンでも問題なく動作します。
すべてのカスタム アクションは try-catch 内にラップされ、システム アカウントにはファイル システムへのフル アクセスがあり、ネットワーク共有ではありません。
また、サービスのインストールは installutil で動作するため、インストーラー自体のエラーに違いありません。

私には、それが呼んでいるように見えます

C:\Windows\Microsoft.NET\Framework\v2.0.50727\InstallUtil.exe "D:\Program Files\test\DbBackupService.exe"

それ以外の

C:\Windows\Microsoft.NET\Framework64\v2.0.50727\InstallUtil.exe "D:\Program Files\test\DbBackupService.exe"

したがって、悪いイメージの例外が発生します。

ただし、その場合、32ビットと64ビットの両方の実行可能ファイルを使用してこのエラーが発生する理由がわかりません...

問題がInstallShield自体にあるのは当然のことです...
ああ、違いが生じる場合に備えて、リモートデスクトップ(mstsc.exe)を使用してサーバーに接続していますが、サーバーに直接アクセスできないため、それがmstscの問題であるかどうかを試すことはできません。

4

3 に答える 3

3

独自のインストーラーを作成することで解決しました。
サービス プロジェクトの出力をリソースとしてインストーラー プロジェクトに埋め込み、指定したフォルダーに書き込むだけです。
次に、プログラムで installutil を実行すると、サービスが正常にインストールされ、機能します。
実際のインストーラーと比較した唯一の欠点は、このようにアンインストーラーがないことですが、私はもう気にしません。InstallShield を使用するよりも独自のインストーラーを展開する方が数日速い場合、InstallShield に何か問題があります。

車輪の再発明はエラーにつながる可能性がありますが、少なくともそれらは私のものであり、解決可能です.
他の人に役立つ場合に備えて、ここで解決策を示します。

using System;
using System.Collections.Generic;
using System.Windows.Forms;


namespace SimpleInstaller
{


    static class Program
    {


        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static int Main(string[] args)
        {
            if (false)
            {
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                Application.Run(new Form1());
            }


            //for (int i = 0; i < args.Length; ++i)
            //{
            //    Console.WriteLine("args[{0}] = {1}", i, args[i]);
            //}


            string strPath = @"C:\pro\DbBackupService\DbBackupService\bin\Debug\DbBackupService.exe";


            string[] callArgs = null;
            string[] argInstall = new string[] { strPath };
            string[] argUnInstall = new string[] { "/u", strPath };

            bool bIsInstallation = true;
            bIsInstallation = false;
            callArgs = bIsInstallation ? argInstall : argUnInstall;


            System.Threading.Thread.CurrentThread.CurrentUICulture = System.Globalization.CultureInfo.CurrentUICulture.GetConsoleFallbackUICulture();

            //if(Console.OutputEncoding.CodePage != 65001 && Console.OutputEncoding.CodePage !=
            if (Console.OutputEncoding.CodePage != 65001
                && Console.OutputEncoding.CodePage != System.Threading.Thread.CurrentThread.CurrentUICulture.TextInfo.OEMCodePage
                && Console.OutputEncoding.CodePage != System.Threading.Thread.CurrentThread.CurrentUICulture.TextInfo.ANSICodePage)
            {
                System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("en-US");
            }



            try
            {
                System.Configuration.Install.ManagedInstallerClass.InstallHelper(callArgs);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                //return -1;
            }

            Console.WriteLine(Environment.NewLine);
            Console.WriteLine(" --- Press any key to continue --- ");
            Console.ReadKey();
            return 0;
        } // End Sub Main


    } // End Class Program


} // End Namespace SimpleInstaller
于 2013-05-23T10:18:48.287 に答える
1

Installer クラスのカスタム アクションのすべてのメソッドをオーバーライドすることで解決しました。いろいろ試した結果、ついに魔法のように機能します。

  public override void Install(IDictionary savedState)
    {
         base.Install(savedState);

    }
 public override void Commit(IDictionary savedState)
    {
        base.Commit(savedState);
    }

    public override void Rollback(IDictionary savedState)
    {
        base.Rollback(savedState);
    }

    public override void Uninstall(IDictionary savedState)
    {
        base.Uninstall(savedState);
    }
于 2018-03-19T13:32:15.603 に答える