how to add new windows service by using C# code
-
Can any body tell me how to add new windows service
wasim khan
-
Can any body tell me how to add new windows service
wasim khan
You mean to say, how to install a window service or you want to create a service?
Parwej Ahamad R & D with IIS 5.0/6.0
-
You mean to say, how to install a window service or you want to create a service?
Parwej Ahamad R & D with IIS 5.0/6.0
hi i have a service that is created by my friend in VB and now i want to add it my Computer Services by C# code how will i do this
wasim khan
-
hi i have a service that is created by my friend in VB and now i want to add it my Computer Services by C# code how will i do this
wasim khan
You can use the
ServiceInstaller
class. It's part of the BCL.Regards, mav -- Black holes are the places where God divided by 0...
-
Can any body tell me how to add new windows service
wasim khan
Well there are certain ways to add a service to your windows registered services. 1) You can use the InstallUtil tool that comes with the .Net Framework;Go to the Visual Studio Command prompt and there type InstallUtil Path-to-Assembly-to-be-installed-as-service This is a manual procedure. 2) Create a new setup project using the Visual Studio Setup Wizard and then under the "File System Editor" add the output (the assembly that you want to install as service", after this go to "Custom Actions Editor", you will see four folders there, 1- Install, 2- Commit, 3- Rollback and 4- Uninstall, right click on Install and click on "Add Custom Action" from the resulting menu, under the result dialog, locate the application folder and locate the assembly of the service that you just added in Application Folder, double click on this assembly. Now when you run the setup project, the service will be added to your windows services if everything goes well. For both the procedures, you would need to go to windows services console and start the service manually.
Muhammad Talha
-
Well there are certain ways to add a service to your windows registered services. 1) You can use the InstallUtil tool that comes with the .Net Framework;Go to the Visual Studio Command prompt and there type InstallUtil Path-to-Assembly-to-be-installed-as-service This is a manual procedure. 2) Create a new setup project using the Visual Studio Setup Wizard and then under the "File System Editor" add the output (the assembly that you want to install as service", after this go to "Custom Actions Editor", you will see four folders there, 1- Install, 2- Commit, 3- Rollback and 4- Uninstall, right click on Install and click on "Add Custom Action" from the resulting menu, under the result dialog, locate the application folder and locate the assembly of the service that you just added in Application Folder, double click on this assembly. Now when you run the setup project, the service will be added to your windows services if everything goes well. For both the procedures, you would need to go to windows services console and start the service manually.
Muhammad Talha
thanx for ur breif Answere i think that will help me
wasim khan
-
Well there are certain ways to add a service to your windows registered services. 1) You can use the InstallUtil tool that comes with the .Net Framework;Go to the Visual Studio Command prompt and there type InstallUtil Path-to-Assembly-to-be-installed-as-service This is a manual procedure. 2) Create a new setup project using the Visual Studio Setup Wizard and then under the "File System Editor" add the output (the assembly that you want to install as service", after this go to "Custom Actions Editor", you will see four folders there, 1- Install, 2- Commit, 3- Rollback and 4- Uninstall, right click on Install and click on "Add Custom Action" from the resulting menu, under the result dialog, locate the application folder and locate the assembly of the service that you just added in Application Folder, double click on this assembly. Now when you run the setup project, the service will be added to your windows services if everything goes well. For both the procedures, you would need to go to windows services console and start the service manually.
Muhammad Talha
Talha can u tell me about how can i add service using C# code and thnax for ur first replay it really work
wasim khan
-
Talha can u tell me about how can i add service using C# code and thnax for ur first replay it really work
wasim khan
Well I also looked a sample on Code Project for this which calls the InstallUtil utility through code, I guess if you search this site for Dynamic Windows Service Installer, you will come across that.... anyway the code is as:
using System; using System.Diagnostics; using System.Net; using System.IO; namespace ServiceInstaller { /// /// /// public enum WindowsServiceAccountType { LocalService, NetworkService, LocalSystem, User } /// /// /// public class WindowsServiceInstallInfo { #region "FIELDS" private System.String _windowsServiceName; private System.String _wsDescription; private readonly string _windowsServicePath; private readonly string _windowsServiceAssemblyName; private WindowsServiceAccountType _wsAccountType; private readonly string _wsAccountUserName; private readonly string _wsAccountPassword; #endregion #region "CONSTRUCTOR" /// /// /// /// Path to folder where Windows Service binary is located. /// Windows Service Assembly Name. /// Windows Service Account Type.(not user type) public WindowsServiceInstallInfo(string windowsServicePath, string windowsServiceAssemblyName, WindowsServiceAccountType wsAccountType) : this("", windowsServicePath, windowsServiceAssemblyName, wsAccountType) { } /// /// /// /// Name of the windows service. /// Path to folder where windows service assembly stored. /// windows service assembly name. /// Windows service account type (not user type) public WindowsServiceInstallInfo(string windowsServiceName, string windowsServicePath, string windowsServiceAssemblyName, WindowsServiceAccountType wsAccountType) : this(windowsServiceName, "", windowsServicePath, windowsServiceAssemblyName, wsAccountType) { } /// /// /// /// Name of windows service.
-
Well I also looked a sample on Code Project for this which calls the InstallUtil utility through code, I guess if you search this site for Dynamic Windows Service Installer, you will come across that.... anyway the code is as:
using System; using System.Diagnostics; using System.Net; using System.IO; namespace ServiceInstaller { /// /// /// public enum WindowsServiceAccountType { LocalService, NetworkService, LocalSystem, User } /// /// /// public class WindowsServiceInstallInfo { #region "FIELDS" private System.String _windowsServiceName; private System.String _wsDescription; private readonly string _windowsServicePath; private readonly string _windowsServiceAssemblyName; private WindowsServiceAccountType _wsAccountType; private readonly string _wsAccountUserName; private readonly string _wsAccountPassword; #endregion #region "CONSTRUCTOR" /// /// /// /// Path to folder where Windows Service binary is located. /// Windows Service Assembly Name. /// Windows Service Account Type.(not user type) public WindowsServiceInstallInfo(string windowsServicePath, string windowsServiceAssemblyName, WindowsServiceAccountType wsAccountType) : this("", windowsServicePath, windowsServiceAssemblyName, wsAccountType) { } /// /// /// /// Name of the windows service. /// Path to folder where windows service assembly stored. /// windows service assembly name. /// Windows service account type (not user type) public WindowsServiceInstallInfo(string windowsServiceName, string windowsServicePath, string windowsServiceAssemblyName, WindowsServiceAccountType wsAccountType) : this(windowsServiceName, "", windowsServicePath, windowsServiceAssemblyName, wsAccountType) { } /// /// /// /// Name of windows service.
thnax Talha i think that is enough for me :|
wasim khan