Click here to Skip to main content
15,921,884 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to call a local .exe in a Windows service and how can i set to restart that service daily using Task Schedular?

What I have tried:

I have no idea on Windows Service
Please help.
Posted
Updated 9-Dec-20 4:27am

1 solution

You can't. The Service can't start an app, because the app would need a User and a UI, and a service doesn't have either of those.

You need to go back to the start and read up on what services are, and what they can / cannot do: What are Windows Services? How Windows Services Work, Examples, Tutorials and More – Stackify[^] is a good start if you follow some of the links, and this will help as well: Tutorial: Create a Windows service app | Microsoft Docs[^]
 
Share this answer
 
Comments
Member 14978771 9-Dec-20 10:42am    
If that exe is a service then how can i install that service from my code?Is that possible?
OriginalGriff 9-Dec-20 10:51am    
https://stackoverflow.com/questions/358700/how-to-install-a-windows-service-programmatically-in-c
Member 14978771 10-Dec-20 4:23am    
I have tried that sample,it was quite the same as i needed but
Getting an Exception like "System.AccessViolationException: 'Attempted to read or write protected memory. This is often an indication that other memory is corrupt.' "
can i get any assistance on this??
OriginalGriff 10-Dec-20 4:53am    
How do you expect us to fix a problem without access to your code and the system it is running on?

You need to use the debugger - or at a pinch start adding logging statements to your code - to find out where it is going wrong, what your code is doing at the time, what the data it is processing looks like ... and we have no access to any of that!
Member 14978771 10-Dec-20 4:59am    
Sorry for that, will update with the code ASP.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900