Service Installer not generating the service exe file
-
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
-
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
-
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
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.
-
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.
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