0

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.

1
  • What is the name of the application? Commented May 17, 2012 at 12:33

2 Answers 2

1

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?

Sign up to request clarification or add additional context in comments.

3 Comments

But it doesn't I checked that
@BigLeonardo exceptions don't lie. What application are you installing, how are you installing it (is there a setup.exe or are you doing stuff manually) what is it installing (services, IIS sites, and so on), and when does the exception occur? Can you post the relevant configuration parts?
@BigLeonardo pay attention to the fact that service name is not the executable name, but the one you define in the installer
0

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.