Précédent   Forum du club des développeurs et IT Pro > Dotnet > Développement Windows > Services Windows
Services Windows Forum d'entraide sur le développement de services Windows.
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse
 
Outils de la discussion
Publicité
'
Vieux 14/12/2012, 09h36   #1
xavpiaf
Membre du Club
 
Inscription : janvier 2008
Messages : 285
Détails du profil
Informations forums :
Inscription : janvier 2008
Messages : 285
Points : 56
Points : 56
Par défaut Problème insttautill : le service existe déjà

Bonjour à tous,

Lorsque je veux installer mon service sur mon pc, cette exception se déclare donc l'installation ne fonctionne pas

System.ComponentModel.Win32Exception : Le service spécifié existe déjà.

Ceci alros queje que je suis sur que le service n'existe pas.
Merci,
xavpiaf est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 14/12/2012, 09h55   #2
GuruuMeditation
Expert Confirmé
 
Avatar de GuruuMeditation
 
Homme Olivier Matis
.Net Architect
Inscription : octobre 2010
Messages : 1 347
Détails du profil
Informations personnelles :
Nom : Homme Olivier Matis
Âge : 38
Localisation : Belgique

Informations professionnelles :
Activité : .Net Architect
Secteur : Conseil

Informations forums :
Inscription : octobre 2010
Messages : 1 347
Points : 2 861
Points : 2 861
Envoyer un message via MSN à GuruuMeditation
Bizarre. Tu as essayé un installlutil /u nomduservice pour être sûr ?
__________________
Microsoft MVP : Visual C#

MCPD - Windows Phone Developer
MCPD - Windows Developer 4

http://www.guruumeditation.net

“If debugging is the process of removing bugs, then programming must be the process of putting them in.”
(Edsger W. Dijkstra)
GuruuMeditation est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 14/12/2012, 10h30   #3
xavpiaf
Membre du Club
 
Inscription : janvier 2008
Messages : 285
Détails du profil
Informations forums :
Inscription : janvier 2008
Messages : 285
Points : 56
Points : 56
oui oui j'ai essayé et cela me dit que le service n'existe pas.
Je pense que cela viendrait de mon fichier installer je suis sur visual studio2010, j'ai fait un service sur visual 2012 il fonction.
Ou sinon si vous connaissez la solution avec 2012 pour faire setup d'installation pour mon service. j'ai essayez avec installshield limited edition mais je n'arrive pas à faire une installation correcte.
Sinon voici mon code :
projectinstaller.cs
Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
 
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration.Install;
using System.Linq;
using System.ServiceProcess;
 
 
namespace WindowsService1
{
    [RunInstaller(true)]
    public partial class ProjectInstaller : System.Configuration.Install.Installer
    {
        public ProjectInstaller()
        {
 
            InitializeComponent();
            ServiceProcessInstaller process = new ServiceProcessInstaller();
            process.Account = ServiceAccount.LocalService;
 
 
            ServiceInstaller serviceAdmin = new ServiceInstaller();
            serviceAdmin.StartType = ServiceStartMode.Automatic;
 
 
            serviceAdmin.ServiceName = "Service3";
            serviceAdmin.DisplayName = "Service3";
            serviceAdmin.Description = "Service3";
 
            Installers.Add(process);
            Installers.Add(serviceAdmin);
        }
 
        private void serviceProcessInstaller1_AfterInstall(object sender, InstallEventArgs e)
        {
 
        }
 
        private void serviceInstaller1_AfterInstall(object sender, InstallEventArgs e)
        {
 
        }
    }
}
projectInstallerDesigner.cs

Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
 
namespace WindowsService1
{
    partial class ProjectInstaller
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;
 
        /// <summary> 
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }
 
        #region Component Designer generated code
 
        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            System.ServiceProcess.ServiceProcessInstaller serviceProcessInstaller1;
            this.serviceInstaller1 = new System.ServiceProcess.ServiceInstaller();
            serviceProcessInstaller1 = new System.ServiceProcess.ServiceProcessInstaller();
            // 
            // serviceProcessInstaller1
            // 
            serviceProcessInstaller1.Account = System.ServiceProcess.ServiceAccount.LocalService;
            //serviceProcessInstaller1.Password = null;
            //serviceProcessInstaller1.Username = null;
            serviceProcessInstaller1.AfterInstall += new System.Configuration.Install.InstallEventHandler(this.serviceProcessInstaller1_AfterInstall);
            // 
            // serviceInstaller1
            // 
            this.serviceInstaller1.ServiceName = "Service3";
            this.serviceInstaller1.StartType = System.ServiceProcess.ServiceStartMode.Automatic;
            this.serviceInstaller1.AfterInstall += new System.Configuration.Install.InstallEventHandler(this.serviceInstaller1_AfterInstall);
            // 
            // ProjectInstaller
            // 
            this.Installers.AddRange(new System.Configuration.Install.Installer[] {
            serviceProcessInstaller1,
            this.serviceInstaller1});
 
        }
 
        #endregion
 
        private System.ServiceProcess.ServiceInstaller serviceInstaller1;
    }
}
xavpiaf est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 14/12/2012, 11h34   #4
xavpiaf
Membre du Club
 
Inscription : janvier 2008
Messages : 285
Détails du profil
Informations forums :
Inscription : janvier 2008
Messages : 285
Points : 56
Points : 56
J'ai maintenant trouvé que le .vhost.exe de mon service tourne toujours comment l'arrêter, et pourquoi ce la fait ça?
Mauvaise piste rien avoir avec ça.
xavpiaf est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 14/12/2012, 12h19   #5
Bluedeep
Expert Confirmé Sénior
 
Homme François
Chef de projet NTIC
Inscription : janvier 2007
Messages : 6 544
Détails du profil
Informations personnelles :
Nom : Homme François
Âge : 52
Localisation : France

Informations professionnelles :
Activité : Chef de projet NTIC

Informations forums :
Inscription : janvier 2007
Messages : 6 544
Points : 13 893
Points : 13 893
Citation:
Envoyé par xavpiaf Voir le message
J'ai maintenant trouvé que le .vhost.exe de mon service tourne toujours comment l'arrêter, et pourquoi ce la fait ça?
Mauvaise piste rien avoir avec ça.
Le .vhost est lié à Visual Studio. Visiblement tu as du lancer le programme du service hors du SCM. (mais en bonne logique il aurait du lever une exception dans ce cas).
__________________

Je ne réponds pas aux questions techniques par MP ! Le forum est là pour ça...


Une réponse vous a aidé ? utiliser le bouton

"L’ennui dans ce monde, c’est que les idiots sont sûrs d’eux et les gens sensés pleins de doutes". B. Russel
Bluedeep est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 14/12/2012, 13h17   #6
xavpiaf
Membre du Club
 
Inscription : janvier 2008
Messages : 285
Détails du profil
Informations forums :
Inscription : janvier 2008
Messages : 285
Points : 56
Points : 56
J'ai supprimé mon projectinstaller et rajouter un nouveua!!Maintenznt l'installation fonctionne par contre lorsque je démarre mon service j'ai un message : " le service windows local a été démarrer puis arrêté automatiquement..."
Et donc mon service ne démarre pas !!
xavpiaf est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 14/12/2012, 14h20   #7
xavpiaf
Membre du Club
 
Inscription : janvier 2008
Messages : 285
Détails du profil
Informations forums :
Inscription : janvier 2008
Messages : 285
Points : 56
Points : 56
J'ai réglé mon problème en changeant LocalService en LocalSystem.
Je voudrais savoir comment démarrer mon service à la fin de l'installation.
xavpiaf est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 14/12/2012, 15h15   #8
xavpiaf
Membre du Club
 
Inscription : janvier 2008
Messages : 285
Détails du profil
Informations forums :
Inscription : janvier 2008
Messages : 285
Points : 56
Points : 56
Solution :
Code :
1
2
3
4
5
6
7
8
 private void serviceInstaller1_AfterInstall(object sender, InstallEventArgs e)
        {
 
 
            ServiceController SC = new ServiceController();
            SC.ServiceName = serviceInstaller1.ServiceName;
            SC.Start();
        }
xavpiaf est déconnecté   Envoyer un message privé Réponse avec citation 10
Réponse Cette discussion est résolue.
Outils de la discussion

Navigation rapide


Fuseau horaire GMT +2. Il est actuellement 14h39.


 
 
 
 
Partenaires

Hébergement Web