Boris Raznikov
Boris Raznikov

Reputation: 2443

running application C# on windows 2003

I have an application on windows server 2003 and installing it in C#. I took the application to install it on server 2008 and got an error of installing: I try to install it

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)

The problem is I don't get how it works without a problem.

Upvotes: 0

Views: 965

Answers (2)

CodeCaster
CodeCaster

Reputation: 151586

Service name contains invalid characters, is empty, or is too long (max length = 80)

Says it all, doesn't it? It all depends on what you are installing and how it's being installed. If the installer is trying to create a service with a given name from somewhere, be sure that 'somewhere' can be read by the installer.

As said here:

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

This causes the same problem for me. Perhaps the installer cant read the app.config?

Upvotes: 1

Sandeep Bansal
Sandeep Bansal

Reputation: 6394

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)

Have a look if the service name is valid, also check that you have the right permissions to create a service through your app.

Upvotes: 0

Related Questions