Problems installing a service on Windows Server

Asked

Viewed 2,135 times

2

  1. I developed an application in Windows Service, in Visual Studio; Projeto em Visual Studio
  2. I cannot install the service on Windows Server;
  3. I made a suggested change and also not registering, occurring the following problem:
    Erro ai Executar o comando installutil.exe inserir a descrição da imagem aqui
  4. I started the prompt as administrator and it didn’t work.
  5. I logged in as an administrator and it didn’t work.
  • 5

    Take a look at this: [Ask]

  • I did a lot of research.. all the answers I found didn’t work and some of them took to use install Shield and for Visual Studio 14 install Shield doesn’t work. Now I’m not a great visual studio connoisseur come ask here...

  • You can edit your question by placing the content of InstallLog, please?

2 answers

3


Are you running Prompt as an administrator? If it is windows 8 I suggest you try to do the same operation in a window 7.

However I already had some problems with installutil.exe... so I do the following::

Add the reference System.Configuration.Install at your service in visual studio. In Main.Cs or Program.Cs (depends on your application) enter the following code:

static void Main(string[] args)
{
    if (Environment.UserInteractive)
    {
        string parameter = string.Concat(args);
        switch (parameter)
        {
            case "--install":
            ManagedInstallerClass.InstallHelper(new[] { Assembly.GetExecutingAssembly().Location });
            break;
            case "--uninstall":
            ManagedInstallerClass.InstallHelper(new[] { "/u", Assembly.GetExecutingAssembly().Location });
            break;
        }
    }
    else
    {
    //aqui é seu codigo para rodar o serviço normalmente.
        ServiceBase[] servicesToRun = new ServiceBase[] 
                          { 
                              new ValidatorService() 
                          };
        ServiceBase.Run(servicesToRun);
    }
}

Now Voce only calls in cmd the generated program: Servico.exe with the --install argument to install the service...to give up using --Uninstall. And now you can throw away the installutil.exe

  • I tried even other applications.. will be problem with windows server 2012

  • If Voce carried out the process and gave the same error it means that some dependency is missing... I saw that Voce is running via G:/ ... try to copy all dlls to a local folder along with iservicos.exe and run the installation process again.

  • Thanks worked both ways.. Voce was copied everything to the same folder and was solved, thank you so much for your attention and help

2

By deduction, apparently the unit G:\ corresponds to a network mapping. In this case, the actual installation will fail.

Try moving all dependencies to a local drive (C:) and install the service in that directory.

If G:\ is a mapping to a unit of the local machine itself, use the original path to which the mapping points to record the service executable. Example:

installutil.exe c:\meu_mapeamento\iERP\(...)\iServicos.exe

  • Your reply helped thanks both your reply and that of our other colleague solved as a solution

Browser other questions tagged

You are not signed in. Login or sign up in order to post.