0

Windows Server 2003にアプリケーションがあり、C#にインストールしています。アプリケーションを使用してサーバー2008にインストールしましたが、インストール中にエラーが発生しました。インストールしようとしました

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandle& ctor, Boolean& bNeedSecurityCheck)
at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean fillCache)
at System.RuntimeType.CreateInstanceImpl(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean fillCache) at System.Activator.CreateInstance(Type type, Boolean nonPublic)
at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) at System.Configuration.Install.AssemblyInstaller.InitializeFromAssembly()
The inner exception System.ArgumentException was thrown with the following error message: Service name contains invalid characters, is empty, or is too long (max length = 80).. at System.ServiceProcess.ServiceInstaller.set_ServiceName(String value)

問題は、問題なく動作する方法がわからないことです。

4

2 に答える 2

1

サービス名に無効な文字が含まれている、空である、または長すぎる(最大長= 80)

全部言ってますよね?それはすべてあなたがインストールしているものとそれがどのようにインストールされているかに依存します。インストーラーがどこかから指定された名前のサービスを作成しようとしている場合は、インストーラーが「どこか」を読み取れることを確認してください。

ここで言ったように:

ServInstall.ServiceName = ConfigurationManager.AppSettings["ServiceName"];

これは私にも同じ問題を引き起こします。おそらく、インストーラーはapp.configを読み取ることができませんか?

于 2012-05-17T12:32:54.533 に答える
0

内部例外 System.ArgumentException がスローされ、次のエラー メッセージが表示されました: Service name contains invalid characters, is empty, or is too long (max length = 80).. at System.ServiceProcess.ServiceInstaller.set_ServiceName(String value)

サービス名が有効かどうかを確認し、アプリを介してサービスを作成するための適切な権限があることも確認してください。

于 2012-05-17T12:33:49.347 に答える