Service restarts automatically after it is manually stopped - c#

I have created a windows service in C#.NET that is continuously running. Now when i stop it from the services.msc initially it shows that it has been stopped but after some time when i refresh the services.msc it shows as started again. I also checked in the task manager at the same time, i see that the exe of my application gets killed but starts on its own again.
Please help.

If you take a look into the properties of your service, there is a tab called Recovery. Maybe there is something configured on this page which automatically restarts the service.
Maybe you can use Process Monitor to find out a little more about who starts your service?

I suppose this was something to do with the operating system. I deployed my service on Win2k3 and it worked just fine. It started perfectly and stopped when i stopped it from Services.msc. I was trying to deploy the service on WinXP earlier. Please let me know if anyone else has faced such an issue.

Related

Windows Service Stop working suddenly and work fine after server restart

I have few service developed in .net. they are working fine but some time suddenly stop working and dont run even i restart them. the only solution is to restart the server. Once server restart everything work fine as previous
I would check Windows Event Viewer for a start to maybe get the error being thrown by .NET Framework when the service stops working. If a server restart is required to get it to run again, it probably is something environmental caused by your service.
With the details provided in your question, that's the best I can advise.

C# MVC app on Azure: Site works fine when freshly deployed but fails after being left idle

I have spent a good bit of time researching this but have not found anybody else reporting the issue that I am having.
I deploy my site and everything is good. I share the link with my QA and UI peeps and everything works for them. But if the site goes for a period of time, such as overnight, without being accessed then the web application is unable to start and reports "Method 'get_CurrentUser' in type ... does not have an implementation." Stopping and restarting the site does not resolve the issue but if I simply re-upload the main .dll file (the exact same version of the .dll) to the site then everything works fine again. For a while, at any rate.
Why would it be okay when newly published but fail after sitting for some time? Any suggestions on troubleshooting this would be greatly appreciated.
IIS has introduced Suspend action for idle timeout, when site is idle for specified duration, IIS will suspend process, god knows what happens exactly but looks like it just hibernates the process. And waking up may not work, so you can change this action to terminate for idle timeout.
Second option is to keep site awake by using pingdom or site24x7 services.
Could it help to try Azure Web App and set Always On?
http://azure.microsoft.com/updates/azure-web-sites-adds-always-on/
It looks like I found a solution.
The app start event in global.asax included "var assemblies = System.Web.Compilation.BuildManager.GetReferencedAssemblies();" in order to make sure that everything loads, but that line was -after- the call that was triggering all of the dependency registration. I cut/pasted that line so that it happens first and the site came up fine when I tried it this morning.

Window Service status it is appearing as running, But not working

I am not quite sure, if I can have an answer to this question but it will be nice to know some suggestions about it.
I have a windows service with two threads. It was working perfectly fine for a time but it seems that it stopped working on last week. When I checked the service status it is appearing as running and startup type is automatic. But service didn't pick the data from service queue. There is no error log and I think thread got stopped, but don't why?
Yes, We found while deployment of Application , there was some dependecy of service on windows, which cause these issue.
We fixed the issue by each time reset the IIS and stop all services and then reinstall them each time.
In our case , we found issue due to incorrect exception handling.
When Installer install the service but in case of any request , which cause any crash while execution, then service is reflected as running state but stop working.

Launch an exe application from windows service

I have a service which should open an exe application ( C# Application ) based on certain conditions. When the service is started in debugging mode ( Visual studio ) it opens the application. But when it is installed as a service, it does not do so. It fails to open the application. Why is this happening?
What you're trying to do isn't directly possible under normal circumstances - simply launching an app in a new process from your Windows Service code is not going to interact with the GUI of the currently logged in user I'm afraid.
There are ways of communicating between a service and the GUI however.
This discussion might point you in the right direction.
Based on your comments, I think what you are really looking for here is a normal userspace application and a scheduler. You might want to use Windows' own scheduler to run the application every monday, if it is an always-on box, or place the application in Startup. When the application runs, it should check the current day of week, and if it is monday and the application has not previously run this day, the application should start. If not, you can safely terminate the application entirely.
Thanks for the answers! I found out a solution for it and im posting it here.
I created a dummy app which is hidden on startup and it does the exact same function that the service was intended to.
1.create a dummy app (copy paste code from service to form application)
Hide it after start up.
2.start the application right after installation.
3.add registry key so that it starts up after a system reboot.
in simple words, clone service behavior.

Workflows not being started when app deployed to another computer

I have a console-app hosted workflow which runs fine on my PC, both under VS 2012 and as an EXE. It starts workflows in response to a Web Services call.
When deployed to another pc, the console app starts ok, doesn't error, and waits for a call to its Web Service. I can 'see' the endpoint.
If I then call that Web Service, the client doesn't error, neither does the console app, but the workflow doesn't start. Nothing is written to the Event Log either.
Any ideas what is going wrong? Thanks
My first check would be to make the console app display something when it receives the remote call so you can be sure the app really got the command.
It seems that the Port Number was the culprit.
I now allow end-user to change this, just in case...

Categories

Resources