Windows Service in Windows XP
-
Hi, I have made set up for user defined Windows Service and tested with Window2000 It working fine but when i install the windows service in Windows XP, i get error while running the windows service can any one tell me is there an\y difference in making Windows service in Win2k and Win XP I am making WIndows service (User defiend) in c# regards, Sanjeev
-
Hi, I have made set up for user defined Windows Service and tested with Window2000 It working fine but when i install the windows service in Windows XP, i get error while running the windows service can any one tell me is there an\y difference in making Windows service in Win2k and Win XP I am making WIndows service (User defiend) in c# regards, Sanjeev
There are differences in what's supported, but it's usually what 2000 doesn't support that XP does. Since you didn't mention what the error was, of what your coding is doing when the error occurs, it's impossible to tell you anything useful. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
-
There are differences in what's supported, but it's usually what 2000 doesn't support that XP does. Since you didn't mention what the error was, of what your coding is doing when the error occurs, it's impossible to tell you anything useful. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
hi I have installed dotnetframework in Win XP and Win2k when i run Windows Service and click on desktop of my product its showing me the following error Commn Language Runtime Debugging Services Process id=0xb50(2896),Thread id=0xb54(2900) click OK to terminate the application Click CANCEL to debug the application What should i write in my Windows Services(User defined service) so that it should not show the above error When i run my product exe from the desktop and after that i run my windows services it shows that only one instance of application is allowed at a time This program should identify if any man.exe exist it should stop that instance and start another instance of man.exe but this program as a windows service does not work protected override void OnStart(string[] args) { // TODO: Add code here to start your service. Process[] aProcesses1; if (aProcesses1.Length > 0) { if(rd1==true) { // The last excel process is the orphaned process which is killed aProcesses1[aProcesses1.Length-1].Kill(); rd1=false; } } int intExcelPID; aProcesses1=Process.GetProcessesByName("man"); string strProc="These are the processes running \n"; for (int i = 0; i <= aProcesses1.GetUpperBound(0); i++) { intExcelPID = aProcesses1[i].Id; strProc+=intExcelPID.ToString()+ " "; } //Retrive from registry the value of Path RegistryKey hklm =Registry.LocalMachine; hklm=hklm.OpenSubKey("SOFTWARE\\man"); Object obp=hklm.GetValue("Path"); string file=obp.ToString() + "\\man.exe"; Process.Start(@file); } When i write the above program it does not work even it does not start when i start my computer Regards sanjeev
-
hi I have installed dotnetframework in Win XP and Win2k when i run Windows Service and click on desktop of my product its showing me the following error Commn Language Runtime Debugging Services Process id=0xb50(2896),Thread id=0xb54(2900) click OK to terminate the application Click CANCEL to debug the application What should i write in my Windows Services(User defined service) so that it should not show the above error When i run my product exe from the desktop and after that i run my windows services it shows that only one instance of application is allowed at a time This program should identify if any man.exe exist it should stop that instance and start another instance of man.exe but this program as a windows service does not work protected override void OnStart(string[] args) { // TODO: Add code here to start your service. Process[] aProcesses1; if (aProcesses1.Length > 0) { if(rd1==true) { // The last excel process is the orphaned process which is killed aProcesses1[aProcesses1.Length-1].Kill(); rd1=false; } } int intExcelPID; aProcesses1=Process.GetProcessesByName("man"); string strProc="These are the processes running \n"; for (int i = 0; i <= aProcesses1.GetUpperBound(0); i++) { intExcelPID = aProcesses1[i].Id; strProc+=intExcelPID.ToString()+ " "; } //Retrive from registry the value of Path RegistryKey hklm =Registry.LocalMachine; hklm=hklm.OpenSubKey("SOFTWARE\\man"); Object obp=hklm.GetValue("Path"); string file=obp.ToString() + "\\man.exe"; Process.Start(@file); } When i write the above program it does not work even it does not start when i start my computer Regards sanjeev
Wow. Where to begin... First, you've put this in the the OnStart procedure of your service. This means that it will only run ONCE per start of the service or on startup of Windows. OnStart is meant for you to start your service code, possibly on another thread. The way you have it setup, your code will execute once, then stop. The error comes up because you have a problem with your code in the OnStart() method. You've got ALOT of problems with this code.
protected override void OnStart(string[] args)
{
// TODO: Add code here to start your service.Process\[\] aProcesses1; if (aProcesses1.Length > 0) { if(rd1==true) { **// The below statement is NOT true! The last Excel process in NOT // guaranteed to be the orphaned process! Whatever you mean by this...** // The last excel process is the orphaned process which is killed **// Your code here is killing off the second to last process in the // list, WHATEVER this process is, even a System process! <- BAD! // You're not checking to see if it is Excel! // On top of that, you're not even retrieving the list of processes. // All your doing is creating a process object that doesn't represent // any process and trying to call Kill on it. THIS WILL FAIL! aProcesses1\[aProcesses1.Length-1\].Kill(); rd1=false; } } int intExcelPID; aProcesses1=Process.GetProcessesByName("man"); string strProc="These are the processes running \\n"; for (int i = 0; i <= aProcesses1.GetUpperBound(0); i++) { intExcelPID = aProcesses1\[i\].Id; strProc+=intExcelPID.ToString()+ " "; } //Retrive from registry the value of Path RegistryKey hklm=Registry.LocalMachine; hklm=hklm.OpenSubKey("SOFTWARE\\\\man"); Object obp=hklm.GetValue("Path"); string file=obp.ToString() + "\\\\man.exe"; Process.Start(@file);
}**
But first, I take it your trying to find Excel processes that are left open by an application? Why? RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome