Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Service Installer not generating the service exe file

Service Installer not generating the service exe file

Scheduled Pinned Locked Moved C#
csharpworkspacehtmlwcfcom
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    JD86
    wrote on last edited by
    #1

    I'm having a little trouble. I'm playing with WCF and trying to install it via a service. I'm following these two articles that I found: http://msdn.microsoft.com/en-us/library/ms733069.aspx[^] and http://a1ashiish-csharp.blogspot.com/2012/02/cnet-how-to-host-wcf-web-service-in.html#.UJGjIMXA_08[^] Now what is happening is I created my WCF DLL Library and I added the WindowsService file and the ProjectInstaller to it. I then created a Windows Setup and added the primary output to the setup project. When it installs it creates the service and links it to my DLL file instead of the windows service created a EXE and linking it to that. So what I end up with is a service that is unable to start because it can't use the DLL file. Here is my ProjectInstaller class:

    \[RunInstaller(true)\]
    public partial class ProjectInstaller : System.Configuration.Install.Installer
    {
        public ProjectInstaller()
        {
            this.AfterInstall += new System.Configuration.Install.InstallEventHandler(ProjectInstaller\_AfterInstall);
    
            InitializeComponent();
        }
    
        void ProjectInstaller\_AfterInstall(object sender, System.Configuration.Install.InstallEventArgs e)
        {
            using (ServiceController sc = new ServiceController("HostingPanelDC"))
            {
                try
                {
                    sc.Start();
                }
                catch (Exception ex)
                {
                    EventLog.WriteEntry("HostingPanel", "Unable to start service. Error: " + ex.Message, EventLogEntryType.Error);
                }
            }
        }
    }
    

    I set the service name and all the service info by clicking serviceInstaller1 and serviceProcessInstaller1 and editing the fields in the properties page. Here is my windows service class:

    partial class WindowsService : ServiceBase
    {
        public ServiceHost serviceHost = null;
    
        public WindowsService()
        {
            InitializeComponent();
    
            ServiceName = "HostingPan
    
    J C 2 Replies Last reply
    0
    • J JD86

      I'm having a little trouble. I'm playing with WCF and trying to install it via a service. I'm following these two articles that I found: http://msdn.microsoft.com/en-us/library/ms733069.aspx[^] and http://a1ashiish-csharp.blogspot.com/2012/02/cnet-how-to-host-wcf-web-service-in.html#.UJGjIMXA_08[^] Now what is happening is I created my WCF DLL Library and I added the WindowsService file and the ProjectInstaller to it. I then created a Windows Setup and added the primary output to the setup project. When it installs it creates the service and links it to my DLL file instead of the windows service created a EXE and linking it to that. So what I end up with is a service that is unable to start because it can't use the DLL file. Here is my ProjectInstaller class:

      \[RunInstaller(true)\]
      public partial class ProjectInstaller : System.Configuration.Install.Installer
      {
          public ProjectInstaller()
          {
              this.AfterInstall += new System.Configuration.Install.InstallEventHandler(ProjectInstaller\_AfterInstall);
      
              InitializeComponent();
          }
      
          void ProjectInstaller\_AfterInstall(object sender, System.Configuration.Install.InstallEventArgs e)
          {
              using (ServiceController sc = new ServiceController("HostingPanelDC"))
              {
                  try
                  {
                      sc.Start();
                  }
                  catch (Exception ex)
                  {
                      EventLog.WriteEntry("HostingPanel", "Unable to start service. Error: " + ex.Message, EventLogEntryType.Error);
                  }
              }
          }
      }
      

      I set the service name and all the service info by clicking serviceInstaller1 and serviceProcessInstaller1 and editing the fields in the properties page. Here is my windows service class:

      partial class WindowsService : ServiceBase
      {
          public ServiceHost serviceHost = null;
      
          public WindowsService()
          {
              InitializeComponent();
      
              ServiceName = "HostingPan
      
      J Offline
      J Offline
      JD86
      wrote on last edited by
      #2

      Duh. Forgot to change the output to windows application and set the startup object. Thanks!

      1 Reply Last reply
      0
      • J JD86

        I'm having a little trouble. I'm playing with WCF and trying to install it via a service. I'm following these two articles that I found: http://msdn.microsoft.com/en-us/library/ms733069.aspx[^] and http://a1ashiish-csharp.blogspot.com/2012/02/cnet-how-to-host-wcf-web-service-in.html#.UJGjIMXA_08[^] Now what is happening is I created my WCF DLL Library and I added the WindowsService file and the ProjectInstaller to it. I then created a Windows Setup and added the primary output to the setup project. When it installs it creates the service and links it to my DLL file instead of the windows service created a EXE and linking it to that. So what I end up with is a service that is unable to start because it can't use the DLL file. Here is my ProjectInstaller class:

        \[RunInstaller(true)\]
        public partial class ProjectInstaller : System.Configuration.Install.Installer
        {
            public ProjectInstaller()
            {
                this.AfterInstall += new System.Configuration.Install.InstallEventHandler(ProjectInstaller\_AfterInstall);
        
                InitializeComponent();
            }
        
            void ProjectInstaller\_AfterInstall(object sender, System.Configuration.Install.InstallEventArgs e)
            {
                using (ServiceController sc = new ServiceController("HostingPanelDC"))
                {
                    try
                    {
                        sc.Start();
                    }
                    catch (Exception ex)
                    {
                        EventLog.WriteEntry("HostingPanel", "Unable to start service. Error: " + ex.Message, EventLogEntryType.Error);
                    }
                }
            }
        }
        

        I set the service name and all the service info by clicking serviceInstaller1 and serviceProcessInstaller1 and editing the fields in the properties page. Here is my windows service class:

        partial class WindowsService : ServiceBase
        {
            public ServiceHost serviceHost = null;
        
            public WindowsService()
            {
                InitializeComponent();
        
                ServiceName = "HostingPan
        
        C Offline
        C Offline
        CafedeJamaica
        wrote on last edited by
        #3

        Suggestion,I was only able to install my service using the command line once I ran my installer, if you google the command line function and use it for your service to show up in the actual list of services.

        J 1 Reply Last reply
        0
        • C CafedeJamaica

          Suggestion,I was only able to install my service using the command line once I ran my installer, if you google the command line function and use it for your service to show up in the actual list of services.

          J Offline
          J Offline
          JD86
          wrote on last edited by
          #4

          Thanks for the suggestion! Once I made the changes listed above I was able to install and start the service automatically with the windows installer once I changed my WCF DLL Library that had the windows service and installer to a Windows Application and set the startup object

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups